diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 90cdd29425..444d05b2a0 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -17,19 +17,6 @@ #include "utils/textinputdialog.hpp" - -//sort QModelIndexList ascending -bool rowGreaterThan(const QModelIndex &index1, const QModelIndex &index2) -{ - return index1.row() >= index2.row(); -} - -//sort QModelIndexList descending -bool rowSmallerThan(const QModelIndex &index1, const QModelIndex &index2) -{ - return index1.row() <= index2.row(); -} - DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gameSettings, LauncherSettings &launcherSettings, QWidget *parent) : mCfgMgr(cfg) , mGameSettings(gameSettings) @@ -121,35 +108,15 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam void DataFilesPage::createActions() { - // Refresh the plugins - QAction *refreshAction = new QAction(tr("Refresh"), this); - refreshAction->setShortcut(QKeySequence(tr("F5"))); - connect(refreshAction, SIGNAL(triggered()), this, SLOT(refresh())); - // We can't create actions inside the .ui file - mNewProfileAction = new QAction(QIcon::fromTheme("document-new"), tr("&New Profile"), this); - mNewProfileAction->setToolTip(tr("New Profile")); - mNewProfileAction->setShortcut(QKeySequence(tr("Ctrl+N"))); - connect(mNewProfileAction, SIGNAL(triggered()), this, SLOT(newProfile())); - - mDeleteProfileAction = new QAction(QIcon::fromTheme("edit-delete"), tr("Delete Profile"), this); - mDeleteProfileAction->setToolTip(tr("Delete Profile")); - connect(mDeleteProfileAction, SIGNAL(triggered()), this, SLOT(deleteProfile())); - - // Add the newly created actions to the toolbuttons - newProfileButton->setDefaultAction(mNewProfileAction); - deleteProfileButton->setDefaultAction(mDeleteProfileAction); + // Add the actions to the toolbuttons + newProfileButton->setDefaultAction(newProfileAction); + deleteProfileButton->setDefaultAction(deleteProfileAction); // Context menu actions - mCheckAction = new QAction(tr("Check Selection"), this); - connect(mCheckAction, SIGNAL(triggered()), this, SLOT(check())); - - mUncheckAction = new QAction(tr("Uncheck Selection"), this); - connect(mUncheckAction, SIGNAL(triggered()), this, SLOT(uncheck())); - mContextMenu = new QMenu(this); - mContextMenu->addAction(mCheckAction); - mContextMenu->addAction(mUncheckAction); + mContextMenu->addAction(checkAction); + mContextMenu->addAction(uncheckAction); } void DataFilesPage::setupDataFiles() @@ -184,6 +151,8 @@ void DataFilesPage::setupDataFiles() profilesComboBox->addItem(QString("Default")); if (profile.isEmpty() || profile == QLatin1String("Default")) { + deleteProfileAction->setEnabled(false); + profilesComboBox->setEditEnabled(false); profilesComboBox->setCurrentIndex(profilesComboBox->findText(QString("Default"))); } else { profilesComboBox->setEditEnabled(true); @@ -257,15 +226,6 @@ void DataFilesPage::saveSettings() } -void DataFilesPage::newProfile() -{ - if (mNewProfileDialog->exec() == QDialog::Accepted) { - QString profile = mNewProfileDialog->lineEdit()->text(); - profilesComboBox->addItem(profile); - profilesComboBox->setCurrentIndex(profilesComboBox->findText(profile)); - } -} - void DataFilesPage::updateOkButton(const QString &text) { // We do this here because we need the profiles combobox text @@ -331,7 +291,16 @@ int DataFilesPage::profilesComboBoxIndex() return profilesComboBox->currentIndex(); } -void DataFilesPage::deleteProfile() +void DataFilesPage::on_newProfileAction_triggered() +{ + if (mNewProfileDialog->exec() == QDialog::Accepted) { + QString profile = mNewProfileDialog->lineEdit()->text(); + profilesComboBox->addItem(profile); + profilesComboBox->setCurrentIndex(profilesComboBox->findText(profile)); + } +} + +void DataFilesPage::on_deleteProfileAction_triggered() { QString profile = profilesComboBox->currentText(); @@ -358,7 +327,7 @@ void DataFilesPage::deleteProfile() } } -void DataFilesPage::check() +void DataFilesPage::on_checkAction_triggered() { if (pluginsTable->hasFocus()) setPluginsCheckstates(Qt::Checked); @@ -368,7 +337,7 @@ void DataFilesPage::check() } -void DataFilesPage::uncheck() +void DataFilesPage::on_uncheckAction_triggered() { if (pluginsTable->hasFocus()) setPluginsCheckstates(Qt::Unchecked); @@ -377,14 +346,6 @@ void DataFilesPage::uncheck() setMastersCheckstates(Qt::Unchecked); } -void DataFilesPage::refresh() -{ -// mDataFilesModel->sort(0); - - // Refresh the plugins table - pluginsTable->scrollToTop(); -} - void DataFilesPage::setMastersCheckstates(Qt::CheckState state) { if (!mastersTable->selectionModel()->hasSelection()) { @@ -476,10 +437,10 @@ void DataFilesPage::profileChanged(const QString &previous, const QString &curre { // Prevent the deletion of the default profile if (current == QLatin1String("Default")) { - mDeleteProfileAction->setEnabled(false); + deleteProfileAction->setEnabled(false); profilesComboBox->setEditEnabled(false); } else { - mDeleteProfileAction->setEnabled(true); + deleteProfileAction->setEnabled(true); profilesComboBox->setEditEnabled(true); } @@ -533,8 +494,8 @@ void DataFilesPage::showContextMenu(const QPoint &point) QModelIndexList indexes = pluginsTable->selectionModel()->selectedIndexes(); // Show the check/uncheck actions depending on the state of the selected items - mUncheckAction->setEnabled(false); - mCheckAction->setEnabled(false); + uncheckAction->setEnabled(false); + checkAction->setEnabled(false); foreach (const QModelIndex &index, indexes) { @@ -548,8 +509,8 @@ void DataFilesPage::showContextMenu(const QPoint &point) return; (mDataFilesModel->checkState(sourceIndex) == Qt::Checked) - ? mUncheckAction->setEnabled(true) - : mCheckAction->setEnabled(true); + ? uncheckAction->setEnabled(true) + : checkAction->setEnabled(true); } // Show menu @@ -564,8 +525,8 @@ void DataFilesPage::showContextMenu(const QPoint &point) QModelIndexList indexes = mastersTable->selectionModel()->selectedIndexes(); // Show the check/uncheck actions depending on the state of the selected items - mUncheckAction->setEnabled(false); - mCheckAction->setEnabled(false); + uncheckAction->setEnabled(false); + checkAction->setEnabled(false); foreach (const QModelIndex &index, indexes) { @@ -578,8 +539,8 @@ void DataFilesPage::showContextMenu(const QPoint &point) return; (mDataFilesModel->checkState(sourceIndex) == Qt::Checked) - ? mUncheckAction->setEnabled(true) - : mCheckAction->setEnabled(true); + ? uncheckAction->setEnabled(true) + : checkAction->setEnabled(true); } mContextMenu->exec(globalPos); diff --git a/apps/launcher/datafilespage.hpp b/apps/launcher/datafilespage.hpp index 301abf59bf..a0b0293309 100644 --- a/apps/launcher/datafilespage.hpp +++ b/apps/launcher/datafilespage.hpp @@ -48,11 +48,10 @@ public slots: void updateViews(); // Action slots - void newProfile(); - void deleteProfile(); - void check(); - void uncheck(); - void refresh(); + void on_newProfileAction_triggered(); + void on_deleteProfileAction_triggered(); + void on_checkAction_triggered(); + void on_uncheckAction_triggered(); private slots: void slotCurrentIndexChanged(int index); @@ -65,23 +64,7 @@ private: QSortFilterProxyModel *mFilterProxyModel; -// QTableView *mMastersTable; -// QTableView *mPluginsTable; - - -// QToolBar *mProfileToolBar; QMenu *mContextMenu; -// QSplitter *mSplitter; - - QAction *mNewProfileAction; - QAction *mDeleteProfileAction; - QAction *mCheckAction; - QAction *mUncheckAction; - -// QAction *mMoveUpAction; -// QAction *mMoveDownAction; -// QAction *mMoveTopAction; -// QAction *mMoveBottomAction; Files::ConfigurationManager &mCfgMgr; diff --git a/apps/launcher/playpage.cpp b/apps/launcher/playpage.cpp index 27b7846ddd..d6d25d71d0 100644 --- a/apps/launcher/playpage.cpp +++ b/apps/launcher/playpage.cpp @@ -6,13 +6,12 @@ PlayPage::PlayPage(QWidget *parent) : QWidget(parent) { setupUi(this); - // Hacks to get the stylesheet look properly on different platforms + // Hacks to get the stylesheet look properly +#ifdef Q_OS_MAC QPlastiqueStyle *style = new QPlastiqueStyle; - QFont font = QApplication::font(); - font.setPointSize(12); // Fixes problem with overlapping items - profilesComboBox->setStyle(style); - profilesComboBox->setFont(font); +#endif + profilesComboBox->setView(new QListView()); connect(profilesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentIndexChanged(int))); connect(playButton, SIGNAL(clicked()), this, SLOT(slotPlayClicked())); diff --git a/apps/launcher/utils/textinputdialog.cpp b/apps/launcher/utils/textinputdialog.cpp index 011e51bf25..a4b36b95ea 100644 --- a/apps/launcher/utils/textinputdialog.cpp +++ b/apps/launcher/utils/textinputdialog.cpp @@ -1,14 +1,14 @@ +#include "textinputdialog.hpp" + #include #include #include -#include #include #include +#include #include -#include "textinputdialog.hpp" - TextInputDialog::TextInputDialog(const QString& title, const QString &text, QWidget *parent) : QDialog(parent) { @@ -38,7 +38,6 @@ TextInputDialog::TextInputDialog(const QString& title, const QString &text, QWid Q_UNUSED(title); #endif - setMaximumHeight(height()); setOkButtonEnabled(false); setModal(true); diff --git a/files/launcher/images/clear.png b/files/launcher/images/clear.png index 6c4b83b7ac..0e72a65ea8 100644 Binary files a/files/launcher/images/clear.png and b/files/launcher/images/clear.png differ diff --git a/files/ui/datafilespage.ui b/files/ui/datafilespage.ui index 044817fb40..5c498d4d57 100644 --- a/files/ui/datafilespage.ui +++ b/files/ui/datafilespage.ui @@ -67,6 +67,9 @@ + + true + 0 @@ -107,6 +110,41 @@ + + + + + + New Profile + + + New Profile + + + Ctrl+N + + + + + + + + Delete Profile + + + Delete Profile + + + + + Check Selection + + + + + Uncheck Selection + + diff --git a/files/ui/mainwindow.ui b/files/ui/mainwindow.ui index 4e1a7854d6..8143fa24df 100644 --- a/files/ui/mainwindow.ui +++ b/files/ui/mainwindow.ui @@ -2,25 +2,17 @@ MainWindow - - - 0 - 0 - 575 - 575 - - 575 - 575 + 525 OpenMW Launcher - + :/images/openmw.png:/images/openmw.png @@ -42,7 +34,7 @@ #iconWidget { background-image: url(":/images/openmw-header.png"); - background-color: white; + background-color: palette(base); background-repeat: no-repeat; background-attachment: scroll; background-position: right; @@ -74,7 +66,7 @@ - + diff --git a/files/ui/playpage.ui b/files/ui/playpage.ui index ccd17f519c..6b8b66b208 100644 --- a/files/ui/playpage.ui +++ b/files/ui/playpage.ui @@ -58,6 +58,7 @@ font-size: 12pt; font-family: "EB Garamond", "EB Garamond 08"; + color: black; } #profilesComboBox::drop-down { @@ -81,11 +82,10 @@ left: 1px; } + #profilesComboBox QAbstractItemView { - border: 2px solid lightgray; - border-radius: 5px; -} - + border: 0px; +} @@ -95,6 +95,7 @@ #profileLabel { font-size: 18pt; font-family: "EB Garamond", "EB Garamond 08"; + color: black; } @@ -185,8 +186,6 @@ - - - +