Finish of the OtherLogs page, and (re)format page related files
This commit is contained in:
parent
5c43842359
commit
4c0dc51110
@ -9,6 +9,7 @@ NamespaceIndentation: None
|
||||
|
||||
BreakBeforeBraces: Allman
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
ColumnLimit: 96
|
||||
MaxEmptyLinesToKeep: 1
|
||||
|
||||
|
@ -14,18 +14,20 @@
|
||||
*/
|
||||
|
||||
#include "PageDialog.h"
|
||||
#include "gui/Platform.h"
|
||||
#include "MultiMC.h"
|
||||
#include "logic/settings/SettingsObject.h"
|
||||
|
||||
#include <gui/widgets/IconLabel.h>
|
||||
#include <gui/widgets/PageContainer.h>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QKeyEvent>
|
||||
|
||||
PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWidget *parent) : QDialog(parent)
|
||||
#include "MultiMC.h"
|
||||
#include "logic/settings/SettingsObject.h"
|
||||
#include "gui/Platform.h"
|
||||
#include "gui/widgets/IconLabel.h"
|
||||
#include "gui/widgets/PageContainer.h"
|
||||
|
||||
PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
MultiMCPlatform::fixWM_CLASS(this);
|
||||
setWindowTitle(pageProvider->dialogTitle());
|
||||
@ -43,9 +45,11 @@ PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWid
|
||||
m_container->addButtons(buttons);
|
||||
|
||||
connect(buttons->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(buttons->button(QDialogButtonBox::Help), SIGNAL(clicked()), m_container, SLOT(help()));
|
||||
connect(buttons->button(QDialogButtonBox::Help), SIGNAL(clicked()), m_container,
|
||||
SLOT(help()));
|
||||
|
||||
restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("PagedGeometry").toByteArray()));
|
||||
restoreGeometry(
|
||||
QByteArray::fromBase64(MMC->settings()->get("PagedGeometry").toByteArray()));
|
||||
}
|
||||
|
||||
void PageDialog::closeEvent(QCloseEvent *event)
|
||||
|
@ -14,8 +14,9 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <gui/pages/BasePageProvider.h>
|
||||
#include "gui/pages/BasePageProvider.h"
|
||||
|
||||
class PageContainer;
|
||||
class PageDialog : public QDialog
|
||||
@ -24,7 +25,7 @@ class PageDialog : public QDialog
|
||||
public:
|
||||
explicit PageDialog(BasePageProviderPtr pageProvider, QString defaultId = QString(),
|
||||
QWidget *parent = 0);
|
||||
virtual ~PageDialog() {};
|
||||
virtual ~PageDialog() {}
|
||||
|
||||
private
|
||||
slots:
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QIcon>
|
||||
#include <memory>
|
||||
@ -25,24 +26,11 @@ public:
|
||||
virtual QString id() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
virtual QIcon icon() const = 0;
|
||||
virtual bool apply()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual bool shouldDisplay() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual QString helpPage() const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
virtual void opened()
|
||||
{
|
||||
}
|
||||
virtual void closed()
|
||||
{
|
||||
}
|
||||
virtual bool apply() { return true; }
|
||||
virtual bool shouldDisplay() const { return true; }
|
||||
virtual QString helpPage() const { return QString(); }
|
||||
virtual void opened() {}
|
||||
virtual void closed() {}
|
||||
int stackIndex = -1;
|
||||
int listIndex = -1;
|
||||
};
|
||||
|
@ -1,27 +1,14 @@
|
||||
#include "InstanceSettingsPage.h"
|
||||
#include <gui/dialogs/VersionSelectDialog.h>
|
||||
#include "logic/NagUtils.h"
|
||||
#include <logic/java/JavaVersionList.h>
|
||||
#include "MultiMC.h"
|
||||
#include <QDialog>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include "ui_InstanceSettingsPage.h"
|
||||
|
||||
QString InstanceSettingsPage::displayName() const
|
||||
{
|
||||
return tr("Settings");
|
||||
}
|
||||
#include <QFileDialog>
|
||||
#include <QDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
QIcon InstanceSettingsPage::icon() const
|
||||
{
|
||||
return QIcon::fromTheme("settings");
|
||||
}
|
||||
|
||||
QString InstanceSettingsPage::id() const
|
||||
{
|
||||
return "settings";
|
||||
}
|
||||
#include "gui/dialogs/VersionSelectDialog.h"
|
||||
#include "logic/NagUtils.h"
|
||||
#include "logic/java/JavaVersionList.h"
|
||||
#include "MultiMC.h"
|
||||
|
||||
InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst)
|
||||
|
@ -14,11 +14,12 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <logic/OneSixInstance.h>
|
||||
#include <logic/net/NetJob.h>
|
||||
#include <logic/java/JavaChecker.h>
|
||||
#include "logic/OneSixInstance.h"
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "logic/java/JavaChecker.h"
|
||||
#include "BasePage.h"
|
||||
|
||||
class JavaChecker;
|
||||
@ -34,11 +35,23 @@ class InstanceSettingsPage : public QWidget, public BasePage
|
||||
public:
|
||||
explicit InstanceSettingsPage(BaseInstance *inst, QWidget *parent = 0);
|
||||
virtual ~InstanceSettingsPage();
|
||||
virtual QString displayName() const override;
|
||||
virtual QIcon icon() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QString displayName() const override
|
||||
{
|
||||
return tr("Settings");
|
||||
}
|
||||
virtual QIcon icon() const override
|
||||
{
|
||||
return QIcon::fromTheme("settings");
|
||||
}
|
||||
virtual QString id() const override
|
||||
{
|
||||
return "settings";
|
||||
}
|
||||
virtual bool apply();
|
||||
virtual QString helpPage() const override { return "Instance-settings"; }
|
||||
virtual QString helpPage() const override
|
||||
{
|
||||
return "Instance-settings";
|
||||
}
|
||||
virtual bool shouldDisplay() const;
|
||||
private slots:
|
||||
void on_javaDetectBtn_clicked();
|
||||
@ -51,6 +64,7 @@ private slots:
|
||||
|
||||
void applySettings();
|
||||
void loadSettings();
|
||||
|
||||
private:
|
||||
Ui::InstanceSettingsPage *ui;
|
||||
BaseInstance *m_instance;
|
||||
|
@ -15,6 +15,13 @@
|
||||
|
||||
#include "LegacyJarModPage.h"
|
||||
#include "ui_LegacyJarModPage.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QFileDialog>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include <pathutils.h>
|
||||
|
||||
#include "gui/dialogs/VersionSelectDialog.h"
|
||||
#include "gui/dialogs/ProgressDialog.h"
|
||||
#include "gui/dialogs/ModEditDialogCommon.h"
|
||||
@ -23,10 +30,6 @@
|
||||
#include "logic/forge/ForgeVersion.h"
|
||||
#include "logic/forge/ForgeVersionList.h"
|
||||
#include "MultiMC.h"
|
||||
#include <pathutils.h>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QFileDialog>
|
||||
#include <QKeyEvent>
|
||||
|
||||
LegacyJarModPage::LegacyJarModPage(LegacyInstance *inst, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::LegacyJarModPage), m_inst(inst)
|
||||
@ -49,26 +52,11 @@ LegacyJarModPage::~LegacyJarModPage()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString LegacyJarModPage::displayName() const
|
||||
{
|
||||
return tr("Jar Mods");
|
||||
}
|
||||
|
||||
bool LegacyJarModPage::shouldDisplay() const
|
||||
{
|
||||
return !m_inst->isRunning();
|
||||
}
|
||||
|
||||
QIcon LegacyJarModPage::icon() const
|
||||
{
|
||||
return QIcon::fromTheme("plugin-red");
|
||||
}
|
||||
|
||||
QString LegacyJarModPage::id() const
|
||||
{
|
||||
return "jarmods";
|
||||
}
|
||||
|
||||
bool LegacyJarModPage::eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
if (ev->type() != QEvent::KeyPress || obj != ui->jarModsTreeView)
|
||||
|
@ -15,8 +15,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <logic/net/NetJob.h>
|
||||
#include <QWidget>
|
||||
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "BasePage.h"
|
||||
|
||||
class ModList;
|
||||
@ -34,10 +35,22 @@ public:
|
||||
explicit LegacyJarModPage(LegacyInstance *inst, QWidget *parent = 0);
|
||||
virtual ~LegacyJarModPage();
|
||||
|
||||
virtual QString displayName() const;
|
||||
virtual QIcon icon() const;
|
||||
virtual QString id() const;
|
||||
virtual QString helpPage() const override { return "Legacy-jar-mods"; }
|
||||
virtual QString displayName() const
|
||||
{
|
||||
return tr("Jar Mods");
|
||||
}
|
||||
virtual QIcon icon() const
|
||||
{
|
||||
return QIcon::fromTheme("plugin-red");
|
||||
}
|
||||
virtual QString id() const
|
||||
{
|
||||
return "jarmods";
|
||||
}
|
||||
virtual QString helpPage() const override
|
||||
{
|
||||
return "Legacy-jar-mods";
|
||||
}
|
||||
virtual bool shouldDisplay() const;
|
||||
|
||||
private
|
||||
|
@ -1,21 +1,7 @@
|
||||
#include "LegacyUpgradePage.h"
|
||||
#include <logic/LegacyInstance.h>
|
||||
#include "ui_LegacyUpgradePage.h"
|
||||
|
||||
QString LegacyUpgradePage::displayName() const
|
||||
{
|
||||
return tr("Upgrade");
|
||||
}
|
||||
|
||||
QIcon LegacyUpgradePage::icon() const
|
||||
{
|
||||
return QIcon::fromTheme("checkupdate");
|
||||
}
|
||||
|
||||
QString LegacyUpgradePage::id() const
|
||||
{
|
||||
return "upgrade";
|
||||
}
|
||||
#include "logic/LegacyInstance.h"
|
||||
|
||||
LegacyUpgradePage::LegacyUpgradePage(LegacyInstance *inst, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::LegacyUpgradePage), m_inst(inst)
|
||||
|
@ -14,10 +14,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <logic/OneSixInstance.h>
|
||||
#include <logic/net/NetJob.h>
|
||||
#include "logic/OneSixInstance.h"
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "BasePage.h"
|
||||
|
||||
class EnabledItemFilter;
|
||||
@ -33,10 +34,22 @@ class LegacyUpgradePage : public QWidget, public BasePage
|
||||
public:
|
||||
explicit LegacyUpgradePage(LegacyInstance *inst, QWidget *parent = 0);
|
||||
virtual ~LegacyUpgradePage();
|
||||
virtual QString displayName() const override;
|
||||
virtual QIcon icon() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QString helpPage() const override { return "Legacy-upgrade"; }
|
||||
virtual QString displayName() const override
|
||||
{
|
||||
return tr("Upgrade");
|
||||
}
|
||||
virtual QIcon icon() const override
|
||||
{
|
||||
return QIcon::fromTheme("checkupdate");
|
||||
}
|
||||
virtual QString id() const override
|
||||
{
|
||||
return "upgrade";
|
||||
}
|
||||
virtual QString helpPage() const override
|
||||
{
|
||||
return "Legacy-upgrade";
|
||||
}
|
||||
virtual bool shouldDisplay() const;
|
||||
private
|
||||
slots:
|
||||
|
@ -7,21 +7,6 @@
|
||||
#include "logic/MinecraftProcess.h"
|
||||
#include "gui/GuiUtil.h"
|
||||
|
||||
QString LogPage::displayName() const
|
||||
{
|
||||
return tr("Minecraft Log");
|
||||
}
|
||||
|
||||
QIcon LogPage::icon() const
|
||||
{
|
||||
return QIcon::fromTheme("refresh");
|
||||
}
|
||||
|
||||
QString LogPage::id() const
|
||||
{
|
||||
return "console";
|
||||
}
|
||||
|
||||
LogPage::LogPage(MinecraftProcess *proc, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::LogPage), m_process(proc)
|
||||
{
|
||||
|
@ -13,13 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <logic/BaseInstance.h>
|
||||
#include <logic/net/NetJob.h>
|
||||
#include <logic/MinecraftProcess.h>
|
||||
#include "logic/BaseInstance.h"
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "logic/MinecraftProcess.h"
|
||||
#include "BasePage.h"
|
||||
|
||||
class EnabledItemFilter;
|
||||
@ -36,11 +36,23 @@ class LogPage : public QWidget, public BasePage
|
||||
public:
|
||||
explicit LogPage(MinecraftProcess *proc, QWidget *parent = 0);
|
||||
virtual ~LogPage();
|
||||
virtual QString displayName() const override;
|
||||
virtual QIcon icon() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QString displayName() const override
|
||||
{
|
||||
return tr("Minecraft Log");
|
||||
}
|
||||
virtual QIcon icon() const override
|
||||
{
|
||||
return QIcon::fromTheme("log");
|
||||
}
|
||||
virtual QString id() const override
|
||||
{
|
||||
return "console";
|
||||
}
|
||||
virtual bool apply();
|
||||
virtual QString helpPage() const override { return "Minecraft-Log"; }
|
||||
virtual QString helpPage() const override
|
||||
{
|
||||
return "Minecraft-Log";
|
||||
}
|
||||
virtual bool shouldDisplay() const;
|
||||
|
||||
private:
|
||||
|
@ -13,9 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "MultiMC.h"
|
||||
#include "ModFolderPage.h"
|
||||
#include "ui_ModFolderPage.h"
|
||||
|
||||
#include <pathutils.h>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QEvent>
|
||||
@ -23,33 +23,18 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
#include "ModFolderPage.h"
|
||||
#include "ui_ModFolderPage.h"
|
||||
#include <pathutils.h>
|
||||
|
||||
#include "MultiMC.h"
|
||||
#include "gui/dialogs/CustomMessageBox.h"
|
||||
#include "gui/dialogs/ModEditDialogCommon.h"
|
||||
|
||||
#include "logic/ModList.h"
|
||||
#include "logic/Mod.h"
|
||||
#include <logic/VersionFilterData.h>
|
||||
#include "logic/VersionFilterData.h"
|
||||
|
||||
QString ModFolderPage::displayName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
QIcon ModFolderPage::icon() const
|
||||
{
|
||||
return QIcon::fromTheme(m_iconName);
|
||||
}
|
||||
|
||||
QString ModFolderPage::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
ModFolderPage::ModFolderPage(BaseInstance * inst, std::shared_ptr<ModList> mods, QString id, QString iconName,
|
||||
QString displayName, QString helpPage, QWidget *parent)
|
||||
ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods, QString id,
|
||||
QString iconName, QString displayName, QString helpPage,
|
||||
QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::ModFolderPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -14,10 +14,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <logic/OneSixInstance.h>
|
||||
#include <logic/net/NetJob.h>
|
||||
#include "logic/OneSixInstance.h"
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "BasePage.h"
|
||||
|
||||
class EnabledItemFilter;
|
||||
@ -36,9 +37,18 @@ public:
|
||||
QString iconName, QString displayName, QString helpPage = "",
|
||||
QWidget *parent = 0);
|
||||
virtual ~ModFolderPage();
|
||||
virtual QString displayName() const override;
|
||||
virtual QIcon icon() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QString displayName() const override
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
virtual QIcon icon() const override
|
||||
{
|
||||
return QIcon::fromTheme(m_iconName);
|
||||
}
|
||||
virtual QString id() const override
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
virtual QString helpPage() const override
|
||||
{
|
||||
return m_helpName;
|
||||
|
@ -1,21 +1,6 @@
|
||||
#include "NotesPage.h"
|
||||
#include "ui_NotesPage.h"
|
||||
|
||||
QString NotesPage::displayName() const
|
||||
{
|
||||
return tr("Notes");
|
||||
}
|
||||
|
||||
QIcon NotesPage::icon() const
|
||||
{
|
||||
return QIcon::fromTheme("news");
|
||||
}
|
||||
|
||||
QString NotesPage::id() const
|
||||
{
|
||||
return "notes";
|
||||
}
|
||||
|
||||
NotesPage::NotesPage(BaseInstance *inst, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::NotesPage), m_inst(inst)
|
||||
{
|
||||
|
@ -14,10 +14,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <logic/BaseInstance.h>
|
||||
#include <logic/net/NetJob.h>
|
||||
#include "logic/BaseInstance.h"
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "BasePage.h"
|
||||
|
||||
class EnabledItemFilter;
|
||||
@ -33,11 +34,23 @@ class NotesPage : public QWidget, public BasePage
|
||||
public:
|
||||
explicit NotesPage(BaseInstance *inst, QWidget *parent = 0);
|
||||
virtual ~NotesPage();
|
||||
virtual QString displayName() const override;
|
||||
virtual QIcon icon() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QString displayName() const override
|
||||
{
|
||||
return tr("Notes");
|
||||
}
|
||||
virtual QIcon icon() const override
|
||||
{
|
||||
return QIcon::fromTheme("news");
|
||||
}
|
||||
virtual QString id() const override
|
||||
{
|
||||
return "notes";
|
||||
}
|
||||
virtual bool apply();
|
||||
virtual QString helpPage() const override { return "Notes"; }
|
||||
virtual QString helpPage() const override
|
||||
{
|
||||
return "Notes";
|
||||
}
|
||||
|
||||
private:
|
||||
Ui::NotesPage *ui;
|
||||
|
@ -1,3 +1,18 @@
|
||||
/* Copyright 2014 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "OtherLogsPage.h"
|
||||
#include "ui_OtherLogsPage.h"
|
||||
|
||||
@ -8,28 +23,18 @@
|
||||
#include "logic/RecursiveFileSystemWatcher.h"
|
||||
#include "logic/BaseInstance.h"
|
||||
|
||||
OtherLogsPage::OtherLogsPage(BaseInstance *instance, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OtherLogsPage),
|
||||
m_instance(instance),
|
||||
OtherLogsPage::OtherLogsPage(BaseInstance *instance, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::OtherLogsPage), m_instance(instance),
|
||||
m_watcher(new RecursiveFileSystemWatcher(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(m_watcher, &RecursiveFileSystemWatcher::filesChanged, [this]()
|
||||
{
|
||||
ui->selectLogBox->clear();
|
||||
ui->selectLogBox->addItems(m_watcher->files());
|
||||
ui->selectLogBox->addItem(tr("&Other"), true);
|
||||
if (m_currentFile.isNull())
|
||||
{
|
||||
ui->selectLogBox->setCurrentIndex(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int index = ui->selectLogBox->findText(m_currentFile);
|
||||
ui->selectLogBox->setCurrentIndex(-1);
|
||||
}
|
||||
});
|
||||
|
||||
m_watcher->setFileExpression(".*\\.log$");
|
||||
m_watcher->setRootDir(QDir::current().absoluteFilePath(m_instance->minecraftRoot()));
|
||||
|
||||
connect(m_watcher, &RecursiveFileSystemWatcher::filesChanged, this,
|
||||
&OtherLogsPage::populateSelectLogBox);
|
||||
populateSelectLogBox();
|
||||
}
|
||||
|
||||
OtherLogsPage::~OtherLogsPage()
|
||||
@ -46,6 +51,22 @@ void OtherLogsPage::closed()
|
||||
m_watcher->disable();
|
||||
}
|
||||
|
||||
void OtherLogsPage::populateSelectLogBox()
|
||||
{
|
||||
ui->selectLogBox->clear();
|
||||
ui->selectLogBox->addItems(m_watcher->files());
|
||||
ui->selectLogBox->addItem(tr("Other"), true);
|
||||
if (m_currentFile.isNull())
|
||||
{
|
||||
ui->selectLogBox->setCurrentIndex(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int index = ui->selectLogBox->findText(m_currentFile);
|
||||
ui->selectLogBox->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index)
|
||||
{
|
||||
QString file;
|
||||
@ -53,7 +74,8 @@ void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index)
|
||||
{
|
||||
if (ui->selectLogBox->itemData(index).isValid())
|
||||
{
|
||||
file = QFileDialog::getOpenFileName(this, tr("Open log file"), m_instance->minecraftRoot(), tr("*.log;;*.txt;;*"));
|
||||
file = QFileDialog::getOpenFileName(
|
||||
this, tr("Open log file"), m_instance->minecraftRoot(), tr("*.log;;*.txt;;*"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -61,9 +83,10 @@ void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index)
|
||||
}
|
||||
}
|
||||
|
||||
if (file.isEmpty() || !QFile::exists(file))
|
||||
if (file.isEmpty() || !QFile::exists(m_instance->minecraftRoot() + "/" + file))
|
||||
{
|
||||
m_currentFile = QString();
|
||||
ui->text->clear();
|
||||
setControlsEnabled(false);
|
||||
}
|
||||
else
|
||||
@ -76,13 +99,14 @@ void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index)
|
||||
|
||||
void OtherLogsPage::on_btnReload_clicked()
|
||||
{
|
||||
QFile file(m_currentFile);
|
||||
QFile file(m_instance->minecraftRoot() + "/" + m_currentFile);
|
||||
if (!file.open(QFile::ReadOnly))
|
||||
{
|
||||
setControlsEnabled(false);
|
||||
ui->btnReload->setEnabled(true); // allow reload
|
||||
m_currentFile = QString();
|
||||
QMessageBox::critical(this, tr("Error"), tr("Unable to open %1 for reading: %2").arg(m_currentFile, file.errorString()));
|
||||
QMessageBox::critical(this, tr("Error"), tr("Unable to open %1 for reading: %2")
|
||||
.arg(m_currentFile, file.errorString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -100,15 +124,17 @@ void OtherLogsPage::on_btnCopy_clicked()
|
||||
}
|
||||
void OtherLogsPage::on_btnDelete_clicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Delete"), tr("Do you really want to delete %1?").arg(m_currentFile), QMessageBox::Yes, QMessageBox::No)
|
||||
== QMessageBox::No)
|
||||
if (QMessageBox::question(this, tr("Delete"),
|
||||
tr("Do you really want to delete %1?").arg(m_currentFile),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QFile file(m_currentFile);
|
||||
QFile file(m_instance->minecraftRoot() + "/" + m_currentFile);
|
||||
if (!file.remove())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Unable to delete %1: %2").arg(m_currentFile, file.errorString()));
|
||||
QMessageBox::critical(this, tr("Error"), tr("Unable to delete %1: %2")
|
||||
.arg(m_currentFile, file.errorString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,26 @@
|
||||
/* Copyright 2014 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "BasePage.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class OtherLogsPage;
|
||||
}
|
||||
|
||||
@ -20,15 +36,27 @@ public:
|
||||
explicit OtherLogsPage(BaseInstance *instance, QWidget *parent = 0);
|
||||
~OtherLogsPage();
|
||||
|
||||
QString id() const override { return "logs"; }
|
||||
QString displayName() const override { return tr("Other logs"); }
|
||||
QIcon icon() const override { return QIcon(); } // TODO
|
||||
QString helpPage() const override { return "Minecraft-Logs"; }
|
||||
QString id() const override
|
||||
{
|
||||
return "logs";
|
||||
}
|
||||
QString displayName() const override
|
||||
{
|
||||
return tr("Other logs");
|
||||
}
|
||||
QIcon icon() const override
|
||||
{
|
||||
return QIcon::fromTheme("log");
|
||||
}
|
||||
QString helpPage() const override
|
||||
{
|
||||
return "Minecraft-Logs";
|
||||
}
|
||||
void opened() override;
|
||||
void closed() override;
|
||||
|
||||
private
|
||||
slots:
|
||||
private slots:
|
||||
void populateSelectLogBox();
|
||||
void on_selectLogBox_currentIndexChanged(const int index);
|
||||
void on_btnReload_clicked();
|
||||
void on_btnPaste_clicked();
|
||||
|
@ -39,7 +39,14 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="selectLogBox"/>
|
||||
<widget class="QComboBox" name="selectLogBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnReload">
|
||||
|
@ -5,8 +5,8 @@ class ResourcePackPage : public ModFolderPage
|
||||
{
|
||||
public:
|
||||
explicit ResourcePackPage(BaseInstance *instance, QWidget *parent = 0)
|
||||
: ModFolderPage(instance, instance->resourcePackList(), "resourcepacks", "resourcepacks",
|
||||
tr("Resource packs"), "Resource-packs", parent)
|
||||
: ModFolderPage(instance, instance->resourcePackList(), "resourcepacks",
|
||||
"resourcepacks", tr("Resource packs"), "Resource-packs", parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,11 @@
|
||||
#include <QFileSystemModel>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QLineEdit>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QClipboard>
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QEvent>
|
||||
#include <QPainter>
|
||||
#include <QClipboard>
|
||||
#include <QDesktopServices>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include <pathutils.h>
|
||||
|
||||
@ -24,22 +25,17 @@
|
||||
#include "logic/tasks/SequentialTask.h"
|
||||
|
||||
#include "logic/RWStorage.h"
|
||||
|
||||
typedef RWStorage<QString, QIcon> SharedIconCache;
|
||||
typedef std::shared_ptr<SharedIconCache> SharedIconCachePtr;
|
||||
|
||||
class ThumbnailingResult : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public Q_SLOTS:
|
||||
inline void emitResultsReady(const QString &path)
|
||||
{
|
||||
emit resultsReady(path);
|
||||
}
|
||||
inline void emitResultsFailed(const QString &path)
|
||||
{
|
||||
emit resultsFailed(path);
|
||||
}
|
||||
Q_SIGNALS:
|
||||
public slots:
|
||||
inline void emitResultsReady(const QString &path) { emit resultsReady(path); }
|
||||
inline void emitResultsFailed(const QString &path) { emit resultsFailed(path); }
|
||||
signals:
|
||||
void resultsReady(const QString &path);
|
||||
void resultsFailed(const QString &path);
|
||||
};
|
||||
@ -97,7 +93,8 @@ public:
|
||||
ThumbnailingResult m_resultEmitter;
|
||||
};
|
||||
|
||||
// this is about as elegant and well written as a bag of bricks with scribbles done by insane asylum patients.
|
||||
// this is about as elegant and well written as a bag of bricks with scribbles done by insane
|
||||
// asylum patients.
|
||||
class FilterModel : public QIdentityProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -110,10 +107,7 @@ public:
|
||||
connect(&watcher, SIGNAL(fileChanged(QString)), SLOT(fileChanged(QString)));
|
||||
// FIXME: the watched file set is not updated when files are removed
|
||||
}
|
||||
virtual ~FilterModel()
|
||||
{
|
||||
m_thumbnailingPool.waitForDone(500);
|
||||
}
|
||||
virtual ~FilterModel() { m_thumbnailingPool.waitForDone(500); }
|
||||
virtual QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const
|
||||
{
|
||||
auto model = sourceModel();
|
||||
@ -126,7 +120,8 @@ public:
|
||||
}
|
||||
if (role == Qt::DecorationRole)
|
||||
{
|
||||
QVariant result = sourceModel()->data(mapToSource(proxyIndex), QFileSystemModel::FilePathRole);
|
||||
QVariant result =
|
||||
sourceModel()->data(mapToSource(proxyIndex), QFileSystemModel::FilePathRole);
|
||||
QString filePath = result.toString();
|
||||
QIcon temp;
|
||||
if (!watched.contains(filePath))
|
||||
@ -162,24 +157,20 @@ public:
|
||||
}
|
||||
return model->setData(mapToSource(index), value.toString() + ".png", role);
|
||||
}
|
||||
|
||||
private:
|
||||
void thumbnailImage(QString path)
|
||||
{
|
||||
auto runnable = new ThumbnailRunnable(path, m_thumbnailCache);
|
||||
connect(&(runnable->m_resultEmitter),SIGNAL(resultsReady(QString)), SLOT(thumbnailReady(QString)));
|
||||
connect(&(runnable->m_resultEmitter),SIGNAL(resultsFailed(QString)), SLOT(thumbnailFailed(QString)));
|
||||
connect(&(runnable->m_resultEmitter), SIGNAL(resultsReady(QString)),
|
||||
SLOT(thumbnailReady(QString)));
|
||||
connect(&(runnable->m_resultEmitter), SIGNAL(resultsFailed(QString)),
|
||||
SLOT(thumbnailFailed(QString)));
|
||||
((QThreadPool &)m_thumbnailingPool).start(runnable);
|
||||
}
|
||||
private
|
||||
slots:
|
||||
void thumbnailReady(QString path)
|
||||
{
|
||||
emit layoutChanged();
|
||||
}
|
||||
void thumbnailFailed(QString path)
|
||||
{
|
||||
m_failed.insert(path);
|
||||
}
|
||||
private slots:
|
||||
void thumbnailReady(QString path) { emit layoutChanged(); }
|
||||
void thumbnailFailed(QString path) { m_failed.insert(path); }
|
||||
void fileChanged(QString filepath)
|
||||
{
|
||||
m_thumbnailCache->setStale(filepath);
|
||||
@ -200,12 +191,8 @@ private:
|
||||
class CenteredEditingDelegate : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
explicit CenteredEditingDelegate(QObject *parent = 0) : QStyledItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
virtual ~CenteredEditingDelegate()
|
||||
{
|
||||
}
|
||||
explicit CenteredEditingDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
|
||||
virtual ~CenteredEditingDelegate() {}
|
||||
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
@ -221,21 +208,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
QString ScreenshotsPage::displayName() const
|
||||
{
|
||||
return tr("Screenshots");
|
||||
}
|
||||
|
||||
QIcon ScreenshotsPage::icon() const
|
||||
{
|
||||
return QIcon::fromTheme("screenshots");
|
||||
}
|
||||
|
||||
QString ScreenshotsPage::id() const
|
||||
{
|
||||
return "screenshots";
|
||||
}
|
||||
|
||||
ScreenshotsPage::ScreenshotsPage(BaseInstance *instance, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::ScreenshotsPage)
|
||||
{
|
||||
@ -341,7 +313,8 @@ void ScreenshotsPage::on_uploadBtn_clicked()
|
||||
QDesktopServices::openUrl(link);
|
||||
CustomMessageBox::selectable(
|
||||
this, tr("Upload finished"),
|
||||
tr("The <a href=\"%1\">link to the uploaded album</a> has been opened in the default browser and placed in your clipboard.<br/>Delete hash: %2 (save "
|
||||
tr("The <a href=\"%1\">link to the uploaded album</a> has been opened in the "
|
||||
"default browser and placed in your clipboard.<br/>Delete hash: %2 (save "
|
||||
"this if you want to be able to edit/delete the album)")
|
||||
.arg(link, imgurAlbum->deleteHash()),
|
||||
QMessageBox::Information)->exec();
|
||||
|
@ -14,11 +14,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <logic/OneSixInstance.h>
|
||||
|
||||
#include "logic/OneSixInstance.h"
|
||||
#include "BasePage.h"
|
||||
#include <QIcon>
|
||||
#include <QEvent>
|
||||
|
||||
class QFileSystemModel;
|
||||
class QIdentityProxyModel;
|
||||
@ -47,12 +47,23 @@ public:
|
||||
};
|
||||
|
||||
virtual bool eventFilter(QObject *, QEvent *);
|
||||
virtual QString displayName() const override;
|
||||
virtual QIcon icon() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QString helpPage() const override { return "Screenshots-management"; }
|
||||
private
|
||||
slots:
|
||||
virtual QString displayName() const override
|
||||
{
|
||||
return tr("Screenshots");
|
||||
}
|
||||
virtual QIcon icon() const override
|
||||
{
|
||||
return QIcon::fromTheme("screenshots");
|
||||
}
|
||||
virtual QString id() const override
|
||||
{
|
||||
return "screenshots";
|
||||
}
|
||||
virtual QString helpPage() const override
|
||||
{
|
||||
return "Screenshots-management";
|
||||
}
|
||||
private slots:
|
||||
void on_uploadBtn_clicked();
|
||||
void on_deleteBtn_clicked();
|
||||
void on_renameBtn_clicked();
|
||||
|
@ -31,6 +31,12 @@
|
||||
|
||||
#include "gui/dialogs/ProgressDialog.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QMessageBox>
|
||||
#include <QListView>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "logic/ModList.h"
|
||||
#include "logic/minecraft/InstanceVersion.h"
|
||||
#include "logic/EnabledItemFilter.h"
|
||||
@ -40,31 +46,14 @@
|
||||
#include "logic/liteloader/LiteLoaderInstaller.h"
|
||||
#include "logic/minecraft/VersionBuilder.h"
|
||||
#include "logic/auth/MojangAccountList.h"
|
||||
#include "logic/Mod.h"
|
||||
#include "logic/icons/IconList.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <logic/Mod.h>
|
||||
#include <logic/icons/IconList.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QListView>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
QString VersionPage::displayName() const
|
||||
{
|
||||
return tr("Version");
|
||||
}
|
||||
|
||||
QIcon VersionPage::icon() const
|
||||
{
|
||||
return MMC->icons()->getIcon(m_inst->iconKey());
|
||||
}
|
||||
|
||||
QString VersionPage::id() const
|
||||
{
|
||||
return "version";
|
||||
}
|
||||
|
||||
bool VersionPage::shouldDisplay() const
|
||||
{
|
||||
return !m_inst->isRunning();
|
||||
|
@ -14,10 +14,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <logic/OneSixInstance.h>
|
||||
#include <logic/net/NetJob.h>
|
||||
#include "logic/OneSixInstance.h"
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "BasePage.h"
|
||||
|
||||
class EnabledItemFilter;
|
||||
@ -33,10 +34,19 @@ class VersionPage : public QWidget, public BasePage
|
||||
public:
|
||||
explicit VersionPage(OneSixInstance *inst, QWidget *parent = 0);
|
||||
virtual ~VersionPage();
|
||||
virtual QString displayName() const override;
|
||||
virtual QString displayName() const override
|
||||
{
|
||||
return tr("Version");
|
||||
}
|
||||
virtual QIcon icon() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QString helpPage() const override { return "Instance-version"; }
|
||||
virtual QString id() const override
|
||||
{
|
||||
return "version";
|
||||
}
|
||||
virtual QString helpPage() const override
|
||||
{
|
||||
return "Instance-version";
|
||||
}
|
||||
virtual bool shouldDisplay() const;
|
||||
private
|
||||
slots:
|
||||
|
@ -14,12 +14,11 @@
|
||||
*/
|
||||
|
||||
#include "PageContainer.h"
|
||||
#include "gui/Platform.h"
|
||||
|
||||
#include <QStackedLayout>
|
||||
#include <QPushButton>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QUrl>
|
||||
#include "MultiMC.h"
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QListView>
|
||||
#include <QLineEdit>
|
||||
@ -27,10 +26,12 @@
|
||||
#include <QDialogButtonBox>
|
||||
#include <QGridLayout>
|
||||
#include <QDesktopServices>
|
||||
#include "logic/settings/SettingsObject.h"
|
||||
|
||||
#include "MultiMC.h"
|
||||
#include "logic/settings/SettingsObject.h"
|
||||
#include "gui/widgets/IconLabel.h"
|
||||
#include "gui/Platform.h"
|
||||
#include "PageContainer_p.h"
|
||||
#include <gui/widgets/IconLabel.h>
|
||||
|
||||
class PageEntryFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
@ -197,5 +198,9 @@ bool PageContainer::requestClose(QCloseEvent *event)
|
||||
if (!page->apply())
|
||||
return false;
|
||||
}
|
||||
if (m_currentPage)
|
||||
{
|
||||
m_currentPage->closed();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -14,9 +14,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QModelIndex>
|
||||
#include <gui/pages/BasePageProvider.h>
|
||||
|
||||
#include "gui/pages/BasePageProvider.h"
|
||||
|
||||
class QLayout;
|
||||
class IconLabel;
|
||||
@ -34,7 +36,7 @@ class PageContainer : public QWidget
|
||||
public:
|
||||
explicit PageContainer(BasePageProviderPtr pageProvider, QString defaultId = QString(),
|
||||
QWidget *parent = 0);
|
||||
virtual ~PageContainer() {};
|
||||
virtual ~PageContainer() {}
|
||||
|
||||
void addButtons(QWidget * buttons);
|
||||
void addButtons(QLayout * buttons);
|
||||
@ -49,7 +51,7 @@ slots:
|
||||
void help();
|
||||
|
||||
private:
|
||||
BasePage * m_currentPage;
|
||||
BasePage * m_currentPage = 0;
|
||||
QSortFilterProxyModel *m_proxyModel;
|
||||
PageModel *m_model;
|
||||
QStackedLayout *m_pageStack;
|
||||
|
@ -1,4 +1,20 @@
|
||||
/* Copyright 2014 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QListView>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QEvent>
|
||||
@ -30,7 +46,7 @@ public:
|
||||
empty.fill(Qt::transparent);
|
||||
m_emptyIcon = QIcon(empty);
|
||||
}
|
||||
virtual ~PageModel() {};
|
||||
virtual ~PageModel() {}
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const
|
||||
{
|
||||
|
@ -1,13 +1,15 @@
|
||||
#include "RecursiveFileSystemWatcher.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QDebug>
|
||||
|
||||
RecursiveFileSystemWatcher::RecursiveFileSystemWatcher(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_watcher(new QFileSystemWatcher(this))
|
||||
: QObject(parent), m_exp(".*"), m_watcher(new QFileSystemWatcher(this))
|
||||
{
|
||||
connect(m_watcher, &QFileSystemWatcher::fileChanged, this, &RecursiveFileSystemWatcher::fileChange);
|
||||
connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &RecursiveFileSystemWatcher::directoryChange);
|
||||
connect(m_watcher, &QFileSystemWatcher::fileChanged, this,
|
||||
&RecursiveFileSystemWatcher::fileChange);
|
||||
connect(m_watcher, &QFileSystemWatcher::directoryChanged, this,
|
||||
&RecursiveFileSystemWatcher::directoryChange);
|
||||
}
|
||||
|
||||
void RecursiveFileSystemWatcher::setRootDir(const QDir &root)
|
||||
@ -34,12 +36,20 @@ void RecursiveFileSystemWatcher::setWatchFiles(const bool watchFiles)
|
||||
|
||||
void RecursiveFileSystemWatcher::enable()
|
||||
{
|
||||
if (m_isEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Q_ASSERT(m_root != QDir::root());
|
||||
addFilesToWatcherRecursive(m_root);
|
||||
m_isEnabled = true;
|
||||
}
|
||||
void RecursiveFileSystemWatcher::disable()
|
||||
{
|
||||
if (!m_isEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_isEnabled = false;
|
||||
m_watcher->removePaths(m_watcher->files());
|
||||
m_watcher->removePaths(m_watcher->directories());
|
||||
@ -57,9 +67,9 @@ void RecursiveFileSystemWatcher::setFiles(const QStringList &files)
|
||||
void RecursiveFileSystemWatcher::addFilesToWatcherRecursive(const QDir &dir)
|
||||
{
|
||||
m_watcher->addPath(dir.absolutePath());
|
||||
for (const QFileInfo &info : dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
|
||||
for (const QString &directory : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
|
||||
{
|
||||
addFilesToWatcherRecursive(info.absoluteDir());
|
||||
addFilesToWatcherRecursive(dir.absoluteFilePath(directory));
|
||||
}
|
||||
if (m_watchFiles)
|
||||
{
|
||||
@ -69,19 +79,19 @@ void RecursiveFileSystemWatcher::addFilesToWatcherRecursive(const QDir &dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
QStringList RecursiveFileSystemWatcher::scanRecursive(const QDir &dir)
|
||||
QStringList RecursiveFileSystemWatcher::scanRecursive(const QDir &directory)
|
||||
{
|
||||
QStringList ret;
|
||||
QRegularExpression exp(m_exp);
|
||||
for (const QFileInfo &info : dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files))
|
||||
for (const QString &dir : directory.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
|
||||
{
|
||||
if (info.isFile() && exp.match(info.absoluteFilePath()).hasMatch())
|
||||
{
|
||||
ret.append(info.absoluteFilePath());
|
||||
ret.append(scanRecursive(directory.absoluteFilePath(dir)));
|
||||
}
|
||||
else if (info.isDir())
|
||||
for (const QString &file : directory.entryList(QDir::Files))
|
||||
{
|
||||
ret.append(scanRecursive(info.absoluteDir()));
|
||||
if (exp.match(file).hasMatch())
|
||||
{
|
||||
ret.append(m_root.relativeFilePath(directory.absoluteFilePath(file)));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -25,8 +25,7 @@ signals:
|
||||
void filesChanged();
|
||||
void fileChanged(const QString &path);
|
||||
|
||||
public
|
||||
slots:
|
||||
public slots:
|
||||
void enable();
|
||||
void disable();
|
||||
|
||||
@ -39,13 +38,12 @@ private:
|
||||
QFileSystemWatcher *m_watcher;
|
||||
|
||||
QStringList m_files;
|
||||
void setFiles(const QStringList &scanRecursive);
|
||||
void setFiles(const QStringList &files);
|
||||
|
||||
void addFilesToWatcherRecursive(const QDir &dir);
|
||||
QStringList scanRecursive(const QDir &dir);
|
||||
|
||||
private
|
||||
slots:
|
||||
private slots:
|
||||
void fileChange(const QString &path);
|
||||
void directoryChange(const QString &path);
|
||||
};
|
||||
|
BIN
resources/multimc/16x16/log.png
Normal file
BIN
resources/multimc/16x16/log.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 630 B |
BIN
resources/multimc/24x24/log.png
Normal file
BIN
resources/multimc/24x24/log.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
resources/multimc/32x32/log.png
Normal file
BIN
resources/multimc/32x32/log.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
resources/multimc/48x48/log.png
Normal file
BIN
resources/multimc/48x48/log.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
resources/multimc/64x64/log.png
Normal file
BIN
resources/multimc/64x64/log.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
@ -165,6 +165,13 @@
|
||||
<file>32x32/noaccount.png</file>
|
||||
<file>48x48/noaccount.png</file>
|
||||
|
||||
<!-- Log file, LGPL, http://www.iconarchive.com/show/crystal-clear-icons-by-everaldo/Mimetype-text-icon.html -->
|
||||
<file>16x16/log.png</file>
|
||||
<file>24x24/log.png</file>
|
||||
<file>32x32/log.png</file>
|
||||
<file>48x48/log.png</file>
|
||||
<file>64x64/log.png</file>
|
||||
|
||||
<!-- placeholder when loading screenshot images -->
|
||||
<file>scalable/screenshot-placeholder.svg</file>
|
||||
</qresource>
|
||||
|
Loading…
Reference in New Issue
Block a user