diff options
author | Forkk <forkk@forkk.net> | 2014-01-04 19:47:28 -0600 |
---|---|---|
committer | Forkk <forkk@forkk.net> | 2014-01-04 19:47:28 -0600 |
commit | ee02eecfdce40f28aaff4e21edb6be0921d8702a (patch) | |
tree | b39f9c3cefaa4ee9454b091cd74386982344a587 /gui | |
parent | d30962bf00b491f3cc23c505b6597c7618ddcd8c (diff) | |
parent | ffacaba1aaa5250a7ebac03059ec8c5c0bb070ad (diff) | |
download | MultiMC-ee02eecfdce40f28aaff4e21edb6be0921d8702a.tar MultiMC-ee02eecfdce40f28aaff4e21edb6be0921d8702a.tar.gz MultiMC-ee02eecfdce40f28aaff4e21edb6be0921d8702a.tar.lz MultiMC-ee02eecfdce40f28aaff4e21edb6be0921d8702a.tar.xz MultiMC-ee02eecfdce40f28aaff4e21edb6be0921d8702a.zip |
Merge branch 'develop' of github.com:MultiMC/MultiMC5 into develop
Diffstat (limited to 'gui')
-rw-r--r-- | gui/MainWindow.cpp | 27 | ||||
-rw-r--r-- | gui/MainWindow.h | 2 | ||||
-rw-r--r-- | gui/dialogs/SettingsDialog.ui | 17 | ||||
-rw-r--r-- | gui/widgets/ModListView.cpp | 20 |
4 files changed, 59 insertions, 7 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index cb9171f1..d1119028 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -166,6 +166,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi view->setFrameShape(QFrame::NoFrame); view->setModel(proxymodel); + view->setContextMenuPolicy(Qt::CustomContextMenu); + connect(view, SIGNAL(customContextMenuRequested(const QPoint&)), + this, SLOT(showInstanceContextMenu(const QPoint&))); + ui->horizontalLayout->addWidget(view); } // The cat background @@ -315,6 +319,29 @@ MainWindow::~MainWindow() delete drawer; } +void MainWindow::showInstanceContextMenu(const QPoint& pos) +{ + if(!view->indexAt(pos).isValid()) + { + return; + } + + QList<QAction *> actions = ui->instanceToolBar->actions(); + + // HACK: Filthy rename button hack because the instance view is getting rewritten anyway + QAction *actionRename; + actionRename = new QAction(tr("Rename"), this); + actionRename->setToolTip(ui->actionRenameInstance->toolTip()); + + connect(actionRename, SIGNAL(triggered(bool)), SLOT(on_actionRenameInstance_triggered())); + + actions.replace(1, actionRename); + + QMenu myMenu; + myMenu.addActions(actions); + myMenu.exec(view->mapToGlobal(pos)); +} + void MainWindow::repopulateAccountsMenu() { accountMenu->clear(); diff --git a/gui/MainWindow.h b/gui/MainWindow.h index 7089b98b..af2f1dca 100644 --- a/gui/MainWindow.h +++ b/gui/MainWindow.h @@ -145,6 +145,8 @@ slots: // called when an icon is changed in the icon model. void iconUpdated(QString); + void showInstanceContextMenu(const QPoint&); + public slots: void instanceActivated(QModelIndex); diff --git a/gui/dialogs/SettingsDialog.ui b/gui/dialogs/SettingsDialog.ui index 12db55a4..7d2708cb 100644 --- a/gui/dialogs/SettingsDialog.ui +++ b/gui/dialogs/SettingsDialog.ui @@ -666,12 +666,21 @@ <tabstop>sortLastLaunchedBtn</tabstop> <tabstop>sortByNameBtn</tabstop> <tabstop>autoUpdateCheckBox</tabstop> + <tabstop>trackFtbBox</tabstop> + <tabstop>ftbLauncherBox</tabstop> + <tabstop>ftbLauncherBrowseBtn</tabstop> + <tabstop>ftbBox</tabstop> + <tabstop>ftbBrowseBtn</tabstop> <tabstop>instDirTextBox</tabstop> - <tabstop>modsDirTextBox</tabstop> - <tabstop>lwjglDirTextBox</tabstop> <tabstop>instDirBrowseBtn</tabstop> + <tabstop>modsDirTextBox</tabstop> <tabstop>modsDirBrowseBtn</tabstop> + <tabstop>lwjglDirTextBox</tabstop> <tabstop>lwjglDirBrowseBtn</tabstop> + <tabstop>iconsDirTextBox</tabstop> + <tabstop>iconsDirBrowseBtn</tabstop> + <tabstop>jsonEditorTextBox</tabstop> + <tabstop>jsonEditorBrowseBtn</tabstop> <tabstop>maximizedCheckBox</tabstop> <tabstop>windowWidthSpinBox</tabstop> <tabstop>windowHeightSpinBox</tabstop> @@ -681,9 +690,13 @@ <tabstop>maxMemSpinBox</tabstop> <tabstop>permGenSpinBox</tabstop> <tabstop>javaPathTextBox</tabstop> + <tabstop>javaBrowseBtn</tabstop> + <tabstop>javaDetectBtn</tabstop> + <tabstop>javaTestBtn</tabstop> <tabstop>jvmArgsTextBox</tabstop> <tabstop>preLaunchCmdTextBox</tabstop> <tabstop>postExitCmdTextBox</tabstop> + <tabstop>settingsTabs</tabstop> </tabstops> <resources> <include location="../../graphics.qrc"/> diff --git a/gui/widgets/ModListView.cpp b/gui/widgets/ModListView.cpp index 9d5950c3..358e6331 100644 --- a/gui/widgets/ModListView.cpp +++ b/gui/widgets/ModListView.cpp @@ -44,9 +44,19 @@ void ModListView::setModel ( QAbstractItemModel* model ) QTreeView::setModel ( model ); auto head = header(); head->setStretchLastSection(false); - head->setSectionResizeMode(0, QHeaderView::ResizeToContents); - head->setSectionResizeMode(1, QHeaderView::Stretch); - for(int i = 2; i < head->count(); i++) - head->setSectionResizeMode(i, QHeaderView::ResizeToContents); - dropIndicatorPosition(); + // HACK: this is true for the checkbox column of mod lists + auto string = model->headerData(0,head->orientation()).toString(); + if(!string.size()) + { + head->setSectionResizeMode(0, QHeaderView::ResizeToContents); + head->setSectionResizeMode(1, QHeaderView::Stretch); + for(int i = 2; i < head->count(); i++) + head->setSectionResizeMode(i, QHeaderView::ResizeToContents); + } + else + { + head->setSectionResizeMode(0, QHeaderView::Stretch); + for(int i = 1; i < head->count(); i++) + head->setSectionResizeMode(i, QHeaderView::ResizeToContents); + } } |