summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/IconPickerDialog.cpp15
-rw-r--r--gui/aboutdialog.cpp8
-rw-r--r--gui/mainwindow.cpp56
-rw-r--r--gui/mainwindow.h1
-rw-r--r--gui/newinstancedialog.cpp9
-rw-r--r--gui/settingsdialog.cpp8
6 files changed, 42 insertions, 55 deletions
diff --git a/gui/IconPickerDialog.cpp b/gui/IconPickerDialog.cpp
index b75eb30c..2dd80292 100644
--- a/gui/IconPickerDialog.cpp
+++ b/gui/IconPickerDialog.cpp
@@ -1,7 +1,8 @@
+#include <MultiMC.h>
#include "IconPickerDialog.h"
#include "instancedelegate.h"
#include "ui_IconPickerDialog.h"
-#include "logic/IconListModel.h"
+#include "logic/lists/IconList.h"
#include <QKeyEvent>
#include <QPushButton>
#include <QFileDialog>
@@ -38,8 +39,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) :
contentsWidget->installEventFilter(this);
- IconList * list = IconList::instance();
- contentsWidget->setModel(list);
+ contentsWidget->setModel(MMC->icons());
auto buttonAdd = ui->buttonBox->addButton("Add Icon",QDialogButtonBox::ResetRole);
auto buttonRemove = ui->buttonBox->addButton("Remove Icon",QDialogButtonBox::ResetRole);
@@ -71,7 +71,6 @@ bool IconPickerDialog::eventFilter ( QObject* obj, QEvent* evt)
return QDialog::eventFilter(obj ,evt);
}
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(evt);
- IconList * list = IconList::instance();
switch(keyEvent->key())
{
case Qt::Key_Delete:
@@ -89,14 +88,12 @@ bool IconPickerDialog::eventFilter ( QObject* obj, QEvent* evt)
void IconPickerDialog::addNewIcon()
{
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Icons", QString(), "Icons (*.png *.jpg *.jpeg)");
- IconList * list = IconList::instance();
- list->installIcons(fileNames);
+ MMC->icons()->installIcons(fileNames);
}
void IconPickerDialog::removeSelectedIcon()
{
- IconList * list = IconList::instance();
- list->deleteIcon(selectedIconKey);
+ MMC->icons()->deleteIcon(selectedIconKey);
}
@@ -119,7 +116,7 @@ void IconPickerDialog::selectionChanged ( QItemSelection selected, QItemSelectio
int IconPickerDialog::exec ( QString selection )
{
- IconList * list = IconList::instance();
+ IconList * list = MMC->icons();
auto contentsWidget = ui->iconView;
selectedIconKey = selection;
diff --git a/gui/aboutdialog.cpp b/gui/aboutdialog.cpp
index 873cc175..9792d4fe 100644
--- a/gui/aboutdialog.cpp
+++ b/gui/aboutdialog.cpp
@@ -1,9 +1,7 @@
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
-#include <AppVersion.h>
-
#include <QIcon>
-#include <QApplication>
+#include <MultiMC.h>
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
@@ -12,10 +10,10 @@ AboutDialog::AboutDialog(QWidget *parent) :
ui->setupUi(this);
ui->icon->setPixmap(QIcon(":/icons/multimc/scalable/apps/multimc.svg").pixmap(64));
- ui->title->setText("MultiMC " + AppVersion::current.toString());
+ ui->title->setText("MultiMC " + MMC->version().toString());
connect(ui->closeButton, SIGNAL(clicked()), SLOT(close()));
- QApplication::instance()->connect(ui->aboutQt, SIGNAL(clicked()), SLOT(aboutQt()));
+ MMC->connect(ui->aboutQt, SIGNAL(clicked()), SLOT(aboutQt()));
}
AboutDialog::~AboutDialog()
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 152773e7..7ddc66a9 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -16,6 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <MultiMC.h>
#include "mainwindow.h"
#include "ui_mainwindow.h"
@@ -23,7 +24,7 @@
#include <QMenu>
#include <QMessageBox>
#include <QInputDialog>
-#include <QApplication>
+
#include <QDesktopServices>
#include <QUrl>
#include <QDir>
@@ -48,33 +49,30 @@
#include "gui/consolewindow.h"
#include "gui/instancesettings.h"
-#include "AppSettings.h"
-#include "AppVersion.h"
-
#include "logic/lists/InstanceList.h"
+#include "logic/lists/MinecraftVersionList.h"
+#include "logic/lists/LwjglVersionList.h"
+#include "logic/lists/IconList.h"
+
#include "logic/tasks/LoginTask.h"
#include "logic/BaseInstance.h"
#include "logic/InstanceFactory.h"
#include "logic/MinecraftProcess.h"
#include "logic/OneSixAssets.h"
#include "logic/OneSixUpdate.h"
-#include "logic/lists/MinecraftVersionList.h"
-#include "logic/lists/LwjglVersionList.h"
-#include <logic/IconListModel.h>
-#include <logic/LegacyInstance.h>
+
+#include "logic/LegacyInstance.h"
#include "instancedelegate.h"
#include "IconPickerDialog.h"
#include "LabeledToolButton.h"
#include "EditNotesDialog.h"
-MainWindow::MainWindow ( QWidget *parent ) :
- QMainWindow ( parent ),
- ui ( new Ui::MainWindow ),
- instList ( globalSettings->get ( "InstanceDir" ).toString() )
+MainWindow::MainWindow ( QWidget *parent )
+ :QMainWindow ( parent ), ui ( new Ui::MainWindow )
{
ui->setupUi ( this );
- setWindowTitle ( QString ( "MultiMC %1" ).arg ( AppVersion::current.toString() ) );
+ setWindowTitle ( QString ( "MultiMC %1" ).arg ( MMC->version().toString() ) );
// Set the selected instance to null
m_selectedInstance = nullptr;
@@ -126,7 +124,7 @@ MainWindow::MainWindow ( QWidget *parent ) :
//proxymodel->setDynamicSortFilter ( true );
// FIXME: instList should be global-ish, or at least not tied to the main window... maybe the application itself?
- proxymodel->setSourceModel ( &instList );
+ proxymodel->setSourceModel ( MMC->instances() );
proxymodel->sort ( 0 );
view->setFrameShape ( QFrame::NoFrame );
view->setModel ( proxymodel );
@@ -135,7 +133,7 @@ MainWindow::MainWindow ( QWidget *parent ) :
}
// The cat background
{
- bool cat_enable = globalSettings->get("TheCat").toBool();
+ bool cat_enable = MMC->settings()->get("TheCat").toBool();
ui->actionCAT->setChecked(cat_enable);
connect(ui->actionCAT, SIGNAL(toggled(bool)), SLOT(onCatToggled(bool)));
setCatBackground(cat_enable);
@@ -151,12 +149,11 @@ MainWindow::MainWindow ( QWidget *parent ) :
);
// model reset -> selection is invalid. All the instance pointers are wrong.
// FIXME: stop using POINTERS everywhere
- connect(&instList,SIGNAL(dataIsInvalid()),SLOT(selectionBad()));
+ connect(MMC->instances() ,SIGNAL(dataIsInvalid()),SLOT(selectionBad()));
// run the things that load and download other things... FIXME: this is NOT the place
// FIXME: invisible actions in the background = NOPE.
{
- instList.loadList();
if (!MinecraftVersionList::getMainList().isLoaded())
{
m_versionLoadTask = MinecraftVersionList::getMainList().getLoadTask();
@@ -212,7 +209,7 @@ bool MainWindow::eventFilter ( QObject* obj, QEvent* ev )
void MainWindow::onCatToggled ( bool state )
{
setCatBackground(state);
- globalSettings->set("TheCat", state);
+ MMC->settings()->set("TheCat", state);
}
void MainWindow::setCatBackground ( bool enabled )
@@ -264,7 +261,7 @@ void MainWindow::on_actionAddInstance_triggered()
BaseInstance *newInstance = NULL;
QString instDirName = DirNameFromString(newInstDlg.instName());
- QString instDir = PathCombine(globalSettings->get("InstanceDir").toString(), instDirName);
+ QString instDir = PathCombine(MMC->settings()->get("InstanceDir").toString(), instDirName);
auto &loader = InstanceFactory::get();
@@ -275,7 +272,7 @@ void MainWindow::on_actionAddInstance_triggered()
case InstanceFactory::NoCreateError:
newInstance->setName(newInstDlg.instName());
newInstance->setIconKey(newInstDlg.iconKey());
- instList.add(InstancePtr(newInstance));
+ MMC->instances()->add(InstancePtr(newInstance));
return;
case InstanceFactory::InstExists:
@@ -305,8 +302,7 @@ void MainWindow::on_actionChangeInstIcon_triggered()
if(dlg.result() == QDialog::Accepted)
{
m_selectedInstance->setIconKey(dlg.selectedIconKey);
- IconList * iconListModel = IconList::instance();
- auto ico =iconListModel->getIcon(dlg.selectedIconKey);
+ auto ico = MMC->icons()->getIcon(dlg.selectedIconKey);
ui->actionChangeInstIcon->setIcon(ico);
}
}
@@ -328,18 +324,18 @@ void MainWindow::on_actionChangeInstGroup_triggered()
void MainWindow::on_actionViewInstanceFolder_triggered()
{
- QString str = globalSettings->get ( "InstanceDir" ).toString();
+ QString str = MMC->settings()->get ( "InstanceDir" ).toString();
openDirInDefaultProgram ( str );
}
void MainWindow::on_actionRefresh_triggered()
{
- instList.loadList();
+ MMC->instances()->loadList();
}
void MainWindow::on_actionViewCentralModsFolder_triggered()
{
- openDirInDefaultProgram ( globalSettings->get ( "CentralModsDir" ).toString() , true);
+ openDirInDefaultProgram ( MMC->settings()->get ( "CentralModsDir" ).toString() , true);
}
void MainWindow::on_actionConfig_Folder_triggered()
@@ -365,7 +361,7 @@ void MainWindow::on_actionSettings_triggered()
void MainWindow::on_actionReportBug_triggered()
{
- openWebPage ( QUrl ( "http://jira.forkk.net/browse/MMC" ) );
+ openWebPage ( QUrl ( "http://multimc.myjetbrains.com/youtrack/dashboard#newissue=yes" ) );
}
void MainWindow::on_actionNews_triggered()
@@ -542,7 +538,7 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
return;
// Prepare GUI: If it shall stay open disable the required parts
- if (globalSettings->get("NoHide").toBool())
+ if (MMC->settings()->get("NoHide").toBool())
{
ui->actionLaunchInstance->setEnabled(false);
}
@@ -647,8 +643,7 @@ void MainWindow::instanceChanged( const QModelIndex& current, const QModelIndex&
ui->actionEditInstMods->setEnabled(m_selectedInstance->menuActionEnabled("actionEditInstMods"));
statusBar()->clearMessage();
statusBar()->showMessage(m_selectedInstance->getStatusbarDescription());
- IconList * iconListModel = IconList::instance();
- auto ico =iconListModel->getIcon(iconKey);
+ auto ico =MMC->icons()->getIcon(iconKey);
ui->actionChangeInstIcon->setIcon(ico);
}
else
@@ -664,8 +659,7 @@ void MainWindow::selectionBad()
statusBar()->clearMessage();
ui->instanceToolBar->setEnabled(false);
renameButton->setText("Rename Instance");
- IconList * iconListModel = IconList::instance();
- auto ico =iconListModel->getIcon(iconKey);
+ auto ico = MMC->icons()->getIcon(iconKey);
ui->actionChangeInstIcon->setIcon(ico);
}
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index e8a6cbcf..2b0e1d34 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -135,7 +135,6 @@ private:
KCategoryDrawer * drawer;
KCategorizedView * view;
InstanceProxyModel * proxymodel;
- InstanceList instList;
MinecraftProcess *proc;
ConsoleWindow *console;
OneSixAssets *assets_downloader;
diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp
index f0a70a1b..ac3bcd7d 100644
--- a/gui/newinstancedialog.cpp
+++ b/gui/newinstancedialog.cpp
@@ -13,12 +13,13 @@
* limitations under the License.
*/
+#include <MultiMC.h>
#include "newinstancedialog.h"
#include "ui_newinstancedialog.h"
#include "logic/InstanceFactory.h"
#include "logic/InstanceVersion.h"
-#include "logic/IconListModel.h"
+#include "logic/lists/IconList.h"
#include "logic/lists/MinecraftVersionList.h"
#include "logic/tasks/Task.h"
@@ -49,8 +50,7 @@ NewInstanceDialog::NewInstanceDialog(QWidget *parent) :
*/
setSelectedVersion(MinecraftVersionList::getMainList().getLatestStable());
InstIconKey = "infinity";
- IconList * list = IconList::instance();
- ui->iconButton->setIcon(list->getIcon(InstIconKey));
+ ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey));
}
NewInstanceDialog::~NewInstanceDialog()
@@ -113,9 +113,8 @@ void NewInstanceDialog::on_iconButton_clicked()
if(dlg.result() == QDialog::Accepted)
{
- IconList * list = IconList::instance();
InstIconKey = dlg.selectedIconKey;
- ui->iconButton->setIcon(list->getIcon(InstIconKey));
+ ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey));
}
}
diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp
index 52093039..a1fbb8e7 100644
--- a/gui/settingsdialog.cpp
+++ b/gui/settingsdialog.cpp
@@ -16,8 +16,8 @@
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
-#include "AppSettings.h"
-
+#include <MultiMC.h>
+#include <settingsobject.h>
#include <QFileDialog>
#include <QMessageBox>
@@ -27,7 +27,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
{
ui->setupUi(this);
- loadSettings(globalSettings);
+ loadSettings(MMC->settings());
updateCheckboxStuff();
}
@@ -85,7 +85,7 @@ void SettingsDialog::on_maximizedCheckBox_clicked(bool checked)
void SettingsDialog::on_buttonBox_accepted()
{
- applySettings(globalSettings);
+ applySettings(MMC->settings());
}
void SettingsDialog::applySettings(SettingsObject *s)