Finished implementing the .ui file for the DataFilesPage

actorid
Pieter van der Kloet 12 years ago
parent 4c9d0563fe
commit 75cf009101

@ -157,6 +157,8 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam
// Create a dialog for the new profile name input // Create a dialog for the new profile name input
mNewProfileDialog = new TextInputDialog(tr("New Profile"), tr("Profile name:"), this); mNewProfileDialog = new TextInputDialog(tr("New Profile"), tr("Profile name:"), this);
connect(profilesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentIndexChanged(int)));
connect(mNewProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(updateOkButton(QString))); connect(mNewProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(updateOkButton(QString)));
connect(pluginsTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckState(QModelIndex))); connect(pluginsTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckState(QModelIndex)));
@ -182,7 +184,7 @@ void DataFilesPage::createActions()
refreshAction->setShortcut(QKeySequence(tr("F5"))); refreshAction->setShortcut(QKeySequence(tr("F5")));
connect(refreshAction, SIGNAL(triggered()), this, SLOT(refresh())); connect(refreshAction, SIGNAL(triggered()), this, SLOT(refresh()));
// Profile actions // We can't create actions inside the .ui file
mNewProfileAction = new QAction(QIcon::fromTheme("document-new"), tr("&New Profile"), this); mNewProfileAction = new QAction(QIcon::fromTheme("document-new"), tr("&New Profile"), this);
mNewProfileAction->setToolTip(tr("New Profile")); mNewProfileAction->setToolTip(tr("New Profile"));
mNewProfileAction->setShortcut(QKeySequence(tr("Ctrl+N"))); mNewProfileAction->setShortcut(QKeySequence(tr("Ctrl+N")));
@ -190,13 +192,11 @@ void DataFilesPage::createActions()
mDeleteProfileAction = new QAction(QIcon::fromTheme("edit-delete"), tr("Delete Profile"), this); mDeleteProfileAction = new QAction(QIcon::fromTheme("edit-delete"), tr("Delete Profile"), this);
mDeleteProfileAction->setToolTip(tr("Delete Profile")); mDeleteProfileAction->setToolTip(tr("Delete Profile"));
mDeleteProfileAction->setShortcut(QKeySequence(tr("Delete")));
connect(mDeleteProfileAction, SIGNAL(triggered()), this, SLOT(deleteProfile())); connect(mDeleteProfileAction, SIGNAL(triggered()), this, SLOT(deleteProfile()));
// Add the newly created actions to the toolbar // Add the newly created actions to the toolbuttons
// mProfileToolBar->addSeparator(); newProfileButton->setDefaultAction(mNewProfileAction);
// mProfileToolBar->addAction(mNewProfileAction); deleteProfileButton->setDefaultAction(mDeleteProfileAction);
// mProfileToolBar->addAction(mDeleteProfileAction);
// Context menu actions // Context menu actions
mCheckAction = new QAction(tr("Check Selection"), this); mCheckAction = new QAction(tr("Check Selection"), this);
@ -369,6 +369,26 @@ void DataFilesPage::updateViews()
pluginsTable->setColumnHidden(8, true); pluginsTable->setColumnHidden(8, true);
} }
void DataFilesPage::setProfilesComboBoxIndex(int index)
{
profilesComboBox->setCurrentIndex(index);
}
void DataFilesPage::slotCurrentIndexChanged(int index)
{
emit profileChanged(index);
}
QAbstractItemModel* DataFilesPage::profilesComboBoxModel()
{
return profilesComboBox->model();
}
int DataFilesPage::profilesComboBoxIndex()
{
return profilesComboBox->currentIndex();
}
void DataFilesPage::deleteProfile() void DataFilesPage::deleteProfile()
{ {
QString profile = profilesComboBox->currentText(); QString profile = profilesComboBox->currentText();

@ -7,11 +7,11 @@
#include "ui_datafilespage.h" #include "ui_datafilespage.h"
class QSortFilterProxyModel; class QSortFilterProxyModel;
class QAbstractItemModel;
class QAction; class QAction;
class QMenu; class QMenu;
class DataFilesModel; class DataFilesModel;
class TextInputDialog; class TextInputDialog;
class GameSettings; class GameSettings;
class LauncherSettings; class LauncherSettings;
@ -26,12 +26,19 @@ class DataFilesPage : public QWidget, private Ui::DataFilesPage
public: public:
DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gameSettings, LauncherSettings &launcherSettings, QWidget *parent = 0); DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gameSettings, LauncherSettings &launcherSettings, QWidget *parent = 0);
QAbstractItemModel* profilesComboBoxModel();
int profilesComboBoxIndex();
void writeConfig(QString profile = QString()); void writeConfig(QString profile = QString());
void saveSettings(); void saveSettings();
signals:
void profileChanged(int index);
public slots: public slots:
void setCheckState(QModelIndex index); void setCheckState(QModelIndex index);
void setProfilesComboBoxIndex(int index);
void filterChanged(const QString filter); void filterChanged(const QString filter);
void showContextMenu(const QPoint &point); void showContextMenu(const QPoint &point);
void profileChanged(const QString &previous, const QString &current); void profileChanged(const QString &previous, const QString &current);
@ -47,6 +54,9 @@ public slots:
void uncheck(); void uncheck();
void refresh(); void refresh();
private slots:
void slotCurrentIndexChanged(int index);
private: private:
DataFilesModel *mDataFilesModel; DataFilesModel *mDataFilesModel;

@ -93,8 +93,8 @@ void MainDialog::createPages()
mDataFilesPage = new DataFilesPage(mCfgMgr, mGameSettings, mLauncherSettings, this); mDataFilesPage = new DataFilesPage(mCfgMgr, mGameSettings, mLauncherSettings, this);
// Set the combobox of the play page to imitate the combobox on the datafilespage // Set the combobox of the play page to imitate the combobox on the datafilespage
// mPlayPage->setProfilesComboBoxModel(mDataFilesPage->mProfilesComboBox->model()); mPlayPage->setProfilesComboBoxModel(mDataFilesPage->profilesComboBoxModel());
// mPlayPage->setProfilesComboBoxIndex(mDataFilesPage->mProfilesComboBox->currentIndex()); mPlayPage->setProfilesComboBoxIndex(mDataFilesPage->profilesComboBoxIndex());
// Add the pages to the stacked widget // Add the pages to the stacked widget
pagesWidget->addWidget(mPlayPage); pagesWidget->addWidget(mPlayPage);
@ -106,8 +106,8 @@ void MainDialog::createPages()
connect(mPlayPage, SIGNAL(playButtonClicked()), this, SLOT(play())); connect(mPlayPage, SIGNAL(playButtonClicked()), this, SLOT(play()));
// connect(mPlayPage, SIGNAL(profileChanged(int)), mDataFilesPage->mProfilesComboBox, SLOT(setCurrentIndex(int))); connect(mPlayPage, SIGNAL(profileChanged(int)), mDataFilesPage, SLOT(setProfilesComboBoxIndex(int)));
// connect(mDataFilesPage->mProfilesComboBox, SIGNAL(currentIndexChanged(int)), mPlayPage, SLOT(setProfilesComboBoxIndex(int))); connect(mDataFilesPage, SIGNAL(profileChanged(int)), mPlayPage, SLOT(setProfilesComboBoxIndex(int)));
} }

Loading…
Cancel
Save