summaryrefslogtreecommitdiffstats
path: root/application/MainWindow.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-10-20 17:18:53 +0200
committerPetr Mrázek <peterix@gmail.com>2015-10-20 17:18:53 +0200
commit125abf502769c2ef092a2f5516d303f0333ae802 (patch)
tree25af0ffea303f1e549ac1a298c03b6862b1b71a3 /application/MainWindow.h
parent9ad99ac4816cb879ec9f1805e7b8d7d3774a9588 (diff)
downloadMultiMC-125abf502769c2ef092a2f5516d303f0333ae802.tar
MultiMC-125abf502769c2ef092a2f5516d303f0333ae802.tar.gz
MultiMC-125abf502769c2ef092a2f5516d303f0333ae802.tar.lz
MultiMC-125abf502769c2ef092a2f5516d303f0333ae802.tar.xz
MultiMC-125abf502769c2ef092a2f5516d303f0333ae802.zip
NOISSUE rename QObjectPtr to shared_qobject_ptr, introduce unique_qobject_ptr, refactor MainWindow to match
Diffstat (limited to 'application/MainWindow.h')
-rw-r--r--application/MainWindow.h68
1 files changed, 33 insertions, 35 deletions
diff --git a/application/MainWindow.h b/application/MainWindow.h
index 7f3f4c63..0685c9f8 100644
--- a/application/MainWindow.h
+++ b/application/MainWindow.h
@@ -15,6 +15,8 @@
#pragma once
+#include <memory>
+
#include <QMainWindow>
#include <QProcess>
#include <QTimer>
@@ -33,32 +35,26 @@ class LabeledToolButton;
class QLabel;
class MinecraftLauncher;
class BaseProfilerFactory;
-
-namespace Ui
-{
-class MainWindow;
-}
+class GroupView;
+class ServerStatus;
class MainWindow : public QMainWindow
{
Q_OBJECT
+ class Ui;
+
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
- void closeEvent(QCloseEvent *event);
-
- // Browser Dialog
- void openWebPage(QUrl url);
+ virtual bool eventFilter(QObject *obj, QEvent *ev) override;
+ virtual void closeEvent(QCloseEvent *event) override;
void checkSetDefaultJava();
void checkInstancePathForProblems();
-private
-slots:
- void setSelectedInstanceById(const QString &id);
-
+private slots:
void onCatToggled(bool);
void on_actionAbout_triggered();
@@ -101,8 +97,6 @@ slots:
void on_mainToolBar_visibilityChanged(bool);
- // void on_instanceView_customContextMenuRequested(const QPoint &pos);
-
void on_actionLaunchInstance_triggered();
void on_actionLaunchInstanceOffline_triggered();
@@ -119,19 +113,19 @@ slots:
void on_actionScreenshots_triggered();
- void taskStart();
void taskEnd();
- // called when an icon is changed in the icon model.
+ /**
+ * called when an icon is changed in the icon model.
+ */
void iconUpdated(QString);
void showInstanceContextMenu(const QPoint &);
void updateToolsMenu();
- void skinJobFinished();
-public
-slots:
+ void skinJobFinished();
+
void instanceActivated(QModelIndex);
void instanceChanged(const QModelIndex &current, const QModelIndex &previous);
@@ -161,10 +155,10 @@ slots:
*/
void downloadUpdates(GoUpdate::Status status);
-protected:
- bool eventFilter(QObject *obj, QEvent *ev);
+private:
void setCatBackground(bool enabled);
void updateInstanceToolIcon(QString new_icon);
+ void setSelectedInstanceById(const QString &id);
void waitForMinecraftVersions();
InstancePtr instanceFromVersion(QString instName, QString instGroup, QString instIcon, BaseVersionPtr version);
@@ -172,28 +166,32 @@ protected:
void finalizeInstance(InstancePtr inst);
void launch(InstancePtr instance, bool online = true, BaseProfilerFactory *profiler = nullptr);
+ /// open a web page in the default browser
+ void openWebPage(QUrl url);
+
private:
- Ui::MainWindow *ui;
- class GroupView *view;
+ std::unique_ptr<Ui> ui;
+
+ // these are managed by Qt's memory management model!
+ GroupView *view;
InstanceProxyModel *proxymodel;
- NetJobPtr skin_download_job;
LabeledToolButton *renameButton;
QToolButton *changeIconButton;
QToolButton *newsLabel;
+ QLabel *m_statusLeft;
+ ServerStatus *m_statusRight;
+ QMenu *accountMenu;
+ QToolButton *accountMenuButton;
+ QAction *manageAccountsAction;
- std::shared_ptr<NewsChecker> m_newsChecker;
- std::shared_ptr<NotificationChecker> m_notificationChecker;
- std::shared_ptr<LaunchController> m_launchController;
+ unique_qobject_ptr<NetJob> skin_download_job;
+ unique_qobject_ptr<NewsChecker> m_newsChecker;
+ unique_qobject_ptr<NotificationChecker> m_notificationChecker;
+ unique_qobject_ptr<LaunchController> m_launchController;
InstancePtr m_selectedInstance;
QString m_currentInstIcon;
+ // managed by the application object
Task *m_versionLoadTask;
-
- QLabel *m_statusLeft;
- class ServerStatus *m_statusRight;
-
- QMenu *accountMenu;
- QToolButton *accountMenuButton;
- QAction *manageAccountsAction;
};