Merge branch 'develop' of github.com:MultiMC/MultiMC5 into develop

This commit is contained in:
Forkk 2014-01-04 19:47:28 -06:00
commit ee02eecfdc
5 changed files with 60 additions and 8 deletions

View File

@ -166,6 +166,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
view->setFrameShape(QFrame::NoFrame); view->setFrameShape(QFrame::NoFrame);
view->setModel(proxymodel); view->setModel(proxymodel);
view->setContextMenuPolicy(Qt::CustomContextMenu);
connect(view, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(showInstanceContextMenu(const QPoint&)));
ui->horizontalLayout->addWidget(view); ui->horizontalLayout->addWidget(view);
} }
// The cat background // The cat background
@ -315,6 +319,29 @@ MainWindow::~MainWindow()
delete drawer; 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() void MainWindow::repopulateAccountsMenu()
{ {
accountMenu->clear(); accountMenu->clear();

View File

@ -145,6 +145,8 @@ slots:
// called when an icon is changed in the icon model. // called when an icon is changed in the icon model.
void iconUpdated(QString); void iconUpdated(QString);
void showInstanceContextMenu(const QPoint&);
public public
slots: slots:
void instanceActivated(QModelIndex); void instanceActivated(QModelIndex);

View File

@ -666,12 +666,21 @@
<tabstop>sortLastLaunchedBtn</tabstop> <tabstop>sortLastLaunchedBtn</tabstop>
<tabstop>sortByNameBtn</tabstop> <tabstop>sortByNameBtn</tabstop>
<tabstop>autoUpdateCheckBox</tabstop> <tabstop>autoUpdateCheckBox</tabstop>
<tabstop>trackFtbBox</tabstop>
<tabstop>ftbLauncherBox</tabstop>
<tabstop>ftbLauncherBrowseBtn</tabstop>
<tabstop>ftbBox</tabstop>
<tabstop>ftbBrowseBtn</tabstop>
<tabstop>instDirTextBox</tabstop> <tabstop>instDirTextBox</tabstop>
<tabstop>modsDirTextBox</tabstop>
<tabstop>lwjglDirTextBox</tabstop>
<tabstop>instDirBrowseBtn</tabstop> <tabstop>instDirBrowseBtn</tabstop>
<tabstop>modsDirTextBox</tabstop>
<tabstop>modsDirBrowseBtn</tabstop> <tabstop>modsDirBrowseBtn</tabstop>
<tabstop>lwjglDirTextBox</tabstop>
<tabstop>lwjglDirBrowseBtn</tabstop> <tabstop>lwjglDirBrowseBtn</tabstop>
<tabstop>iconsDirTextBox</tabstop>
<tabstop>iconsDirBrowseBtn</tabstop>
<tabstop>jsonEditorTextBox</tabstop>
<tabstop>jsonEditorBrowseBtn</tabstop>
<tabstop>maximizedCheckBox</tabstop> <tabstop>maximizedCheckBox</tabstop>
<tabstop>windowWidthSpinBox</tabstop> <tabstop>windowWidthSpinBox</tabstop>
<tabstop>windowHeightSpinBox</tabstop> <tabstop>windowHeightSpinBox</tabstop>
@ -681,9 +690,13 @@
<tabstop>maxMemSpinBox</tabstop> <tabstop>maxMemSpinBox</tabstop>
<tabstop>permGenSpinBox</tabstop> <tabstop>permGenSpinBox</tabstop>
<tabstop>javaPathTextBox</tabstop> <tabstop>javaPathTextBox</tabstop>
<tabstop>javaBrowseBtn</tabstop>
<tabstop>javaDetectBtn</tabstop>
<tabstop>javaTestBtn</tabstop>
<tabstop>jvmArgsTextBox</tabstop> <tabstop>jvmArgsTextBox</tabstop>
<tabstop>preLaunchCmdTextBox</tabstop> <tabstop>preLaunchCmdTextBox</tabstop>
<tabstop>postExitCmdTextBox</tabstop> <tabstop>postExitCmdTextBox</tabstop>
<tabstop>settingsTabs</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../../graphics.qrc"/> <include location="../../graphics.qrc"/>

View File

@ -44,9 +44,19 @@ void ModListView::setModel ( QAbstractItemModel* model )
QTreeView::setModel ( model ); QTreeView::setModel ( model );
auto head = header(); auto head = header();
head->setStretchLastSection(false); head->setStretchLastSection(false);
head->setSectionResizeMode(0, QHeaderView::ResizeToContents); // HACK: this is true for the checkbox column of mod lists
head->setSectionResizeMode(1, QHeaderView::Stretch); auto string = model->headerData(0,head->orientation()).toString();
for(int i = 2; i < head->count(); i++) if(!string.size())
head->setSectionResizeMode(i, QHeaderView::ResizeToContents); {
dropIndicatorPosition(); 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);
}
} }

View File

@ -416,7 +416,7 @@ QVariant ModList::data(const QModelIndex &index, int role) const
switch (index.column()) switch (index.column())
{ {
case ActiveColumn: case ActiveColumn:
return mods[row].enabled(); return mods[row].enabled() ? Qt::Checked: Qt::Unchecked;
default: default:
return QVariant(); return QVariant();
} }