Change log to be a QMainWindow
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
parent
ef3bf75715
commit
d77889f26d
10 changed files with 73 additions and 86 deletions
|
@ -92,6 +92,7 @@
|
|||
#include "InstanceWindow.h"
|
||||
|
||||
#include "ui/GuiUtil.h"
|
||||
#include "ui/ViewLogWindow.h"
|
||||
#include "ui/dialogs/AboutDialog.h"
|
||||
#include "ui/dialogs/CopyInstanceDialog.h"
|
||||
#include "ui/dialogs/CreateShortcutDialog.h"
|
||||
|
@ -103,7 +104,6 @@
|
|||
#include "ui/dialogs/NewInstanceDialog.h"
|
||||
#include "ui/dialogs/NewsDialog.h"
|
||||
#include "ui/dialogs/ProgressDialog.h"
|
||||
#include "ui/dialogs/ViewLogDialog.h"
|
||||
#include "ui/instanceview/InstanceDelegate.h"
|
||||
#include "ui/instanceview/InstanceProxyModel.h"
|
||||
#include "ui/instanceview/InstanceView.h"
|
||||
|
@ -240,10 +240,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
}
|
||||
|
||||
{ // logs viewing
|
||||
connect(ui->actionViewLog, &QAction::triggered, this, [this] {
|
||||
ViewLogDialog dialog(this);
|
||||
dialog.exec();
|
||||
});
|
||||
connect(ui->actionViewLog, &QAction::triggered, this, [] { APPLICATION->showLogWindow(); });
|
||||
}
|
||||
|
||||
// add the toolbar toggles to the view menu
|
||||
|
|
25
launcher/ui/ViewLogWindow.cpp
Normal file
25
launcher/ui/ViewLogWindow.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include <QCloseEvent>
|
||||
|
||||
#include "ViewLogWindow.h"
|
||||
|
||||
#include "ui/pages/instance/OtherLogsPage.h"
|
||||
|
||||
ViewLogWindow::ViewLogWindow(QWidget* parent)
|
||||
: QMainWindow(parent), m_page(new OtherLogsPage("launcher-logs", tr("Launcher Logs"), "Launcher-Logs", nullptr, parent))
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setWindowIcon(APPLICATION->getThemedIcon("log"));
|
||||
setWindowTitle(tr("View Launcher Logs"));
|
||||
setCentralWidget(m_page);
|
||||
setMinimumSize(m_page->size());
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
m_page->opened();
|
||||
show();
|
||||
}
|
||||
|
||||
void ViewLogWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
m_page->closed();
|
||||
emit isClosing();
|
||||
event->accept();
|
||||
}
|
23
launcher/ui/ViewLogWindow.h
Normal file
23
launcher/ui/ViewLogWindow.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
class OtherLogsPage;
|
||||
|
||||
class ViewLogWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ViewLogWindow(QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void isClosing();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent*) override;
|
||||
|
||||
private:
|
||||
OtherLogsPage* m_page;
|
||||
};
|
|
@ -1,21 +0,0 @@
|
|||
#include "ViewLogDialog.h"
|
||||
#include "ui_ViewLogDialog.h"
|
||||
|
||||
#include "ui/pages/instance/OtherLogsPage.h"
|
||||
|
||||
ViewLogDialog::ViewLogDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::ViewLogDialog)
|
||||
, m_page(new OtherLogsPage("launcher-logs", tr("Launcher Logs"), "Launcher-Logs", nullptr, parent))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->verticalLayout->insertWidget(0, m_page);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
m_page->opened();
|
||||
}
|
||||
|
||||
ViewLogDialog::~ViewLogDialog()
|
||||
{
|
||||
m_page->closed();
|
||||
delete ui;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QHash>
|
||||
|
||||
namespace Ui {
|
||||
class ViewLogDialog;
|
||||
}
|
||||
|
||||
class OtherLogsPage;
|
||||
|
||||
class ViewLogDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ViewLogDialog(QWidget* parent = nullptr);
|
||||
~ViewLogDialog();
|
||||
|
||||
private:
|
||||
Ui::ViewLogDialog* ui;
|
||||
OtherLogsPage* m_page;
|
||||
};
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ViewLogDialog</class>
|
||||
<widget class="QDialog" name="ViewLogDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>825</width>
|
||||
<height>782</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>View Launcher Logs</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Add table
Add a link
Reference in a new issue