Finished implementing the .ui file for the DataFilesPage

pull/37/head
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
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(pluginsTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckState(QModelIndex)));
@ -182,7 +184,7 @@ void DataFilesPage::createActions()
refreshAction->setShortcut(QKeySequence(tr("F5")));
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->setToolTip(tr("New Profile"));
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->setToolTip(tr("Delete Profile"));
mDeleteProfileAction->setShortcut(QKeySequence(tr("Delete")));
connect(mDeleteProfileAction, SIGNAL(triggered()), this, SLOT(deleteProfile()));
// Add the newly created actions to the toolbar
// mProfileToolBar->addSeparator();
// mProfileToolBar->addAction(mNewProfileAction);
// mProfileToolBar->addAction(mDeleteProfileAction);
// Add the newly created actions to the toolbuttons
newProfileButton->setDefaultAction(mNewProfileAction);
deleteProfileButton->setDefaultAction(mDeleteProfileAction);
// Context menu actions
mCheckAction = new QAction(tr("Check Selection"), this);
@ -369,6 +369,26 @@ void DataFilesPage::updateViews()
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()
{
QString profile = profilesComboBox->currentText();

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

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

Loading…
Cancel
Save