Use separate window for viewing logs
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
parent
1aa8d7bc13
commit
e4a801fdf7
8 changed files with 94 additions and 16 deletions
|
@ -66,7 +66,6 @@
|
|||
#include "ui/pages/global/LauncherPage.h"
|
||||
#include "ui/pages/global/MinecraftPage.h"
|
||||
#include "ui/pages/global/ProxyPage.h"
|
||||
#include "ui/pages/instance/OtherLogsPage.h"
|
||||
|
||||
#include "ui/setupwizard/AutoJavaWizardPage.h"
|
||||
#include "ui/setupwizard/JavaWizardPage.h"
|
||||
|
@ -905,7 +904,6 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||
m_globalSettingsProvider->addPage<APIPage>();
|
||||
m_globalSettingsProvider->addPage<ExternalToolsPage>();
|
||||
m_globalSettingsProvider->addPage<ProxyPage>();
|
||||
m_globalSettingsProvider->addPageCreator([]() { return new OtherLogsPage("launcher-logs", tr("Logs"), "Launcher-Logs"); });
|
||||
}
|
||||
|
||||
PixmapCache::setInstance(new PixmapCache(this));
|
||||
|
|
|
@ -1098,6 +1098,8 @@ SET(LAUNCHER_SOURCES
|
|||
ui/dialogs/ResourceUpdateDialog.h
|
||||
ui/dialogs/InstallLoaderDialog.cpp
|
||||
ui/dialogs/InstallLoaderDialog.h
|
||||
ui/dialogs/ViewLogDialog.cpp
|
||||
ui/dialogs/ViewLogDialog.h
|
||||
|
||||
ui/dialogs/skins/SkinManageDialog.cpp
|
||||
ui/dialogs/skins/SkinManageDialog.h
|
||||
|
@ -1256,6 +1258,7 @@ qt_wrap_ui(LAUNCHER_UI
|
|||
ui/dialogs/ScrollMessageBox.ui
|
||||
ui/dialogs/BlockedModsDialog.ui
|
||||
ui/dialogs/ChooseProviderDialog.ui
|
||||
ui/dialogs/ViewLogDialog.ui
|
||||
ui/dialogs/skins/SkinManageDialog.ui
|
||||
)
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@
|
|||
#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"
|
||||
|
@ -238,14 +239,11 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
ui->actionViewJavaFolder->setEnabled(BuildConfig.JAVA_DOWNLOADER_ENABLED);
|
||||
}
|
||||
|
||||
{ // logs upload
|
||||
|
||||
auto menu = new QMenu(this);
|
||||
for (auto file : QDir("logs").entryInfoList(QDir::Files)) {
|
||||
auto action = menu->addAction(file.fileName());
|
||||
connect(action, &QAction::triggered, this, [this, file] { GuiUtil::uploadPaste(file.fileName(), file, this); });
|
||||
}
|
||||
ui->actionUploadLog->setMenu(menu);
|
||||
{ // logs viewing
|
||||
connect(ui->actionViewLog, &QAction::triggered, this, [this] {
|
||||
ViewLogDialog dialog(this);
|
||||
dialog.exec();
|
||||
});
|
||||
}
|
||||
|
||||
// add the toolbar toggles to the view menu
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
</property>
|
||||
<addaction name="actionClearMetadata"/>
|
||||
<addaction name="actionReportBug"/>
|
||||
<addaction name="actionUploadLog"/>
|
||||
<addaction name="actionViewLog"/>
|
||||
<addaction name="actionAddToPATH"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionMATRIX"/>
|
||||
|
@ -663,16 +663,16 @@
|
|||
<string>Clear cached metadata</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUploadLog">
|
||||
<action name="actionViewLog">
|
||||
<property name="icon">
|
||||
<iconset theme="log">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Upload logs</string>
|
||||
<string>View logs</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Upload launcher logs to the selected log provider</string>
|
||||
<string>View current and previous launcher logs</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddToPATH">
|
||||
|
|
21
launcher/ui/dialogs/ViewLogDialog.cpp
Normal file
21
launcher/ui/dialogs/ViewLogDialog.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#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;
|
||||
}
|
22
launcher/ui/dialogs/ViewLogDialog.h
Normal file
22
launcher/ui/dialogs/ViewLogDialog.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#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;
|
||||
};
|
34
launcher/ui/dialogs/ViewLogDialog.ui
Normal file
34
launcher/ui/dialogs/ViewLogDialog.ui
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?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>
|
|
@ -231,7 +231,8 @@ void OtherLogsPage::on_btnReload_clicked()
|
|||
if (!m_model)
|
||||
return;
|
||||
m_model->clear();
|
||||
m_container->refreshContainer();
|
||||
if (m_container)
|
||||
m_container->refreshContainer();
|
||||
} else {
|
||||
reload();
|
||||
}
|
||||
|
@ -358,7 +359,8 @@ void OtherLogsPage::reload()
|
|||
|
||||
void OtherLogsPage::on_btnPaste_clicked()
|
||||
{
|
||||
GuiUtil::uploadPaste(m_currentFile, ui->text->toPlainText(), this);
|
||||
QString name = m_currentFile.isEmpty() ? displayName() : m_currentFile;
|
||||
GuiUtil::uploadPaste(name, ui->text->toPlainText(), this);
|
||||
}
|
||||
|
||||
void OtherLogsPage::on_btnCopy_clicked()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue