summaryrefslogtreecommitdiffstats
path: root/application/pages/instance/ScreenshotsPage.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2019-07-17 02:01:29 +0200
committerPetr Mrázek <peterix@gmail.com>2019-07-17 02:01:29 +0200
commit95febe543615c16d5b97cdd6f379c9a62102321d (patch)
tree60c3cf31de93e0be96e28c85297e3440b1325e4c /application/pages/instance/ScreenshotsPage.cpp
parent5b153a516566446b88cca73afac34f9abfdd82e2 (diff)
downloadMultiMC-95febe543615c16d5b97cdd6f379c9a62102321d.tar
MultiMC-95febe543615c16d5b97cdd6f379c9a62102321d.tar.gz
MultiMC-95febe543615c16d5b97cdd6f379c9a62102321d.tar.lz
MultiMC-95febe543615c16d5b97cdd6f379c9a62102321d.tar.xz
MultiMC-95febe543615c16d5b97cdd6f379c9a62102321d.zip
NOISSUE convert rest of the instance pages to use toolbars for side menus
Diffstat (limited to 'application/pages/instance/ScreenshotsPage.cpp')
-rw-r--r--application/pages/instance/ScreenshotsPage.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/application/pages/instance/ScreenshotsPage.cpp b/application/pages/instance/ScreenshotsPage.cpp
index e61bf5c1..0c00d1c4 100644
--- a/application/pages/instance/ScreenshotsPage.cpp
+++ b/application/pages/instance/ScreenshotsPage.cpp
@@ -13,6 +13,7 @@
#include <QPainter>
#include <QClipboard>
#include <QKeyEvent>
+#include <QMenu>
#include <MultiMC.h>
@@ -209,7 +210,7 @@ public:
};
ScreenshotsPage::ScreenshotsPage(QString path, QWidget *parent)
- : QWidget(parent), ui(new Ui::ScreenshotsPage)
+ : QMainWindow(parent), ui(new Ui::ScreenshotsPage)
{
m_model.reset(new QFileSystemModel());
m_filterModel.reset(new FilterModel());
@@ -222,7 +223,6 @@ ScreenshotsPage::ScreenshotsPage(QString path, QWidget *parent)
m_valid = FS::ensureFolderPathExists(m_folder);
ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
ui->listView->setIconSize(QSize(128, 128));
ui->listView->setGridSize(QSize(192, 160));
ui->listView->setSpacing(9);
@@ -248,10 +248,10 @@ bool ScreenshotsPage::eventFilter(QObject *obj, QEvent *evt)
switch (keyEvent->key())
{
case Qt::Key_Delete:
- on_deleteBtn_clicked();
+ on_actionDelete_triggered();
return true;
case Qt::Key_F2:
- on_renameBtn_clicked();
+ on_actionRename_triggered();
return true;
default:
break;
@@ -264,6 +264,13 @@ ScreenshotsPage::~ScreenshotsPage()
delete ui;
}
+QMenu * ScreenshotsPage::createPopupMenu()
+{
+ QMenu* filteredMenu = QMainWindow::createPopupMenu();
+ filteredMenu->removeAction( ui->toolBar->toggleViewAction() );
+ return filteredMenu;
+}
+
void ScreenshotsPage::onItemActivated(QModelIndex index)
{
if (!index.isValid())
@@ -273,12 +280,12 @@ void ScreenshotsPage::onItemActivated(QModelIndex index)
DesktopServices::openFile(info.absoluteFilePath());
}
-void ScreenshotsPage::on_viewFolderBtn_clicked()
+void ScreenshotsPage::on_actionView_Folder_triggered()
{
DesktopServices::openDirectory(m_folder, true);
}
-void ScreenshotsPage::on_uploadBtn_clicked()
+void ScreenshotsPage::on_actionUpload_triggered()
{
auto selection = ui->listView->selectionModel()->selectedRows();
if (selection.isEmpty())
@@ -353,7 +360,7 @@ void ScreenshotsPage::on_uploadBtn_clicked()
m_uploadActive = false;
}
-void ScreenshotsPage::on_deleteBtn_clicked()
+void ScreenshotsPage::on_actionDelete_triggered()
{
auto mbox = CustomMessageBox::selectable(
this, tr("Are you sure?"), tr("This will delete all selected screenshots."),
@@ -370,7 +377,7 @@ void ScreenshotsPage::on_deleteBtn_clicked()
}
}
-void ScreenshotsPage::on_renameBtn_clicked()
+void ScreenshotsPage::on_actionRename_triggered()
{
auto selection = ui->listView->selectionModel()->selectedIndexes();
if (selection.isEmpty())