Made the Play page use a .ui file too

pull/37/head
Pieter van der Kloet 12 years ago
parent f2193bb1ba
commit 0a6e3701ab

@ -94,8 +94,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->mProfilesComboBox->setModel(mDataFilesPage->mProfilesComboBox->model());
mPlayPage->mProfilesComboBox->setCurrentIndex(mDataFilesPage->mProfilesComboBox->currentIndex());
mPlayPage->setProfilesComboBoxModel(mDataFilesPage->mProfilesComboBox->model());
mPlayPage->setProfilesComboBoxIndex(mDataFilesPage->mProfilesComboBox->currentIndex());
// Add the pages to the stacked widget
pagesWidget->addWidget(mPlayPage);
@ -105,15 +105,10 @@ void MainDialog::createPages()
// Select the first page
iconWidget->setCurrentItem(iconWidget->item(0), QItemSelectionModel::Select);
connect(mPlayPage->mPlayButton, SIGNAL(clicked()), this, SLOT(play()));
connect(mPlayPage, SIGNAL(playButtonClicked()), this, SLOT(play()));
connect(mPlayPage->mProfilesComboBox,
SIGNAL(currentIndexChanged(int)),
mDataFilesPage->mProfilesComboBox, SLOT(setCurrentIndex(int)));
connect(mDataFilesPage->mProfilesComboBox,
SIGNAL(currentIndexChanged(int)),
mPlayPage->mProfilesComboBox, SLOT(setCurrentIndex(int)));
connect(mPlayPage, SIGNAL(profileChanged(int)), mDataFilesPage->mProfilesComboBox, SLOT(setCurrentIndex(int)));
connect(mDataFilesPage->mProfilesComboBox, SIGNAL(currentIndexChanged(int)), mPlayPage, SLOT(setProfilesComboBoxIndex(int)));
}

@ -28,12 +28,6 @@ class MainDialog : public QMainWindow, private Ui::MainWindow
public:
MainDialog();
// GameSettings &gameSettings,
// GraphicsSettings &GraphicsSettings,
// LauncherSettings &launcherSettings);
bool setup();
bool showFirstRunDialog();
@ -58,9 +52,6 @@ private:
void closeEvent(QCloseEvent *event);
// QListWidget *mIconWidget;
// QStackedWidget *mPagesWidget;
PlayPage *mPlayPage;
GraphicsPage *mGraphicsPage;
DataFilesPage *mDataFilesPage;

@ -4,45 +4,37 @@
PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
{
QWidget *playWidget = new QWidget(this);
playWidget->setObjectName("PlayGroup");
playWidget->setFixedSize(QSize(425, 375));
mPlayButton = new QPushButton(tr("Play"), playWidget);
mPlayButton->setObjectName("PlayButton");
mPlayButton->setMinimumSize(QSize(200, 50));
QLabel *profileLabel = new QLabel(tr("Current Profile:"), playWidget);
profileLabel->setObjectName("ProfileLabel");
setupUi(this);
// Hacks to get the stylesheet look properly on different platforms
QPlastiqueStyle *style = new QPlastiqueStyle;
QFont font = QApplication::font();
font.setPointSize(12); // Fixes problem with overlapping items
mProfilesComboBox = new QComboBox(playWidget);
mProfilesComboBox->setObjectName("ProfilesComboBox");
mProfilesComboBox->setStyle(style);
mProfilesComboBox->setFont(font);
QGridLayout *playLayout = new QGridLayout(playWidget);
profilesComboBox->setStyle(style);
profilesComboBox->setFont(font);
QSpacerItem *hSpacer1 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
QSpacerItem *hSpacer2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
connect(profilesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentIndexChanged(int)));
connect(playButton, SIGNAL(clicked()), this, SLOT(slotPlayClicked()));
QSpacerItem *vSpacer1 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
QSpacerItem *vSpacer2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
}
playLayout->addWidget(mPlayButton, 1, 1, 1, 1);
playLayout->addWidget(profileLabel, 2, 1, 1, 1);
playLayout->addWidget(mProfilesComboBox, 3, 1, 1, 1);
playLayout->addItem(hSpacer1, 2, 0, 1, 1);
playLayout->addItem(hSpacer2, 2, 2, 1, 1);
playLayout->addItem(vSpacer1, 0, 1, 1, 1);
playLayout->addItem(vSpacer2, 4, 1, 1, 1);
void PlayPage::setProfilesComboBoxModel(QAbstractItemModel *model)
{
profilesComboBox->setModel(model);
}
QHBoxLayout *pageLayout = new QHBoxLayout(this);
void PlayPage::setProfilesComboBoxIndex(int index)
{
profilesComboBox->setCurrentIndex(index);
}
pageLayout->addWidget(playWidget);
void PlayPage::slotCurrentIndexChanged(int index)
{
emit profileChanged(index);
}
void PlayPage::slotPlayClicked()
{
emit playButtonClicked();
}

@ -3,19 +3,33 @@
#include <QWidget>
#include "ui_playpage.h"
class QComboBox;
class QPushButton;
class QAbstractItemModel;
class PlayPage : public QWidget
class PlayPage : public QWidget, private Ui::PlayPage
{
Q_OBJECT
public:
PlayPage(QWidget *parent = 0);
void setProfilesComboBoxModel(QAbstractItemModel *model);
signals:
void profileChanged(int index);
void playButtonClicked();
public slots:
void setProfilesComboBoxIndex(int index);
private slots:
void slotCurrentIndexChanged(int index);
void slotPlayClicked();
QComboBox *mProfilesComboBox;
QPushButton *mPlayButton;
};
#endif
#endif

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>graphicsPage</class>
<widget class="QWidget" name="graphicsPage">
<class>GraphicsPage</class>
<widget class="QWidget" name="GraphicsPage">
<property name="geometry">
<rect>
<x>0</x>

@ -1,107 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>playPage</class>
<widget class="QWidget" name="playPage">
<property name="styleSheet">
<string notr="true">#playPage {
<class>PlayPage</class>
<widget class="QWidget" name="PlayPage">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="Scroll">
<property name="styleSheet">
<string notr="true">#Scroll {
background-image: url(&quot;:/images/playpage-background.png&quot;);
background-repeat: no-repeat;
background-position: top;
}
</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>30</number>
</property>
<property name="topMargin">
<number>100</number>
</property>
<property name="rightMargin">
<number>30</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="playButton">
<property name="minimumSize">
<size>
<width>200</width>
<height>85</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>85</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#playButton {
height: 50px;
margin-bottom: 30px;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1,
stop:0 rgba(255, 255, 255, 200),
stop:0.1 rgba(255, 255, 255, 15),
stop:0.49 rgba(255, 255, 255, 75),
stop:0.5 rgba(0, 0, 0, 0),
stop:0.9 rgba(0, 0, 0, 55),
stop:1 rgba(0, 0, 0, 100));
font-size: 26pt;
font-family: &quot;EB Garamond&quot;, &quot;EB Garamond 08&quot;;
color: black;
border-right: 1px solid rgba(0, 0, 0, 155);
border-left: 1px solid rgba(0, 0, 0, 55);
border-top: 1px solid rgba(0, 0, 0, 55);
border-bottom: 1px solid rgba(0, 0, 0, 155);
border-radius: 5px;
}
#playButton:hover {
border-bottom: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(164, 192, 228, 255), stop:1 rgba(255, 255, 255, 0));
border-top: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(164, 192, 228, 255), stop:1 rgba(255, 255, 255, 0));
border-right: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(164, 192, 228, 255), stop:1 rgba(255, 255, 255, 0));
border-left: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(164, 192, 228, 255), stop:1 rgba(255, 255, 255, 0));
border-width: 2px;
border-style: solid;
}
#playButton:pressed {
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 rgba(0, 0, 0, 75),
stop:0.1 rgba(0, 0, 0, 15),
stop:0.2 rgba(255, 255, 255, 55)
stop:0.95 rgba(255, 255, 255, 55),
stop:1 rgba(255, 255, 255, 155));
border: 1px solid rgba(0, 0, 0, 55);
}</string>
</property>
<property name="text">
<string>Play</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="profileLabel">
<property name="styleSheet">
<string notr="true">#profileLabel {
font-size: 18pt;
font-family: &quot;EB Garamond&quot;, &quot;EB Garamond 08&quot;;
}
</string>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string>Current Profile:</string>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QComboBox" name="profilesComboBox">
<property name="styleSheet">
<string notr="true">#profilesComboBox {
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>30</number>
</property>
<property name="topMargin">
<number>100</number>
</property>
<property name="rightMargin">
<number>30</number>
</property>
<item row="4" column="1">
<widget class="QComboBox" name="profilesComboBox">
<property name="styleSheet">
<string notr="true">#profilesComboBox {
padding: 1px 18px 1px 3px;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 white, stop:0.2 rgba(0, 0, 0, 25), stop:1 white);
@ -155,22 +86,103 @@
border-radius: 5px;
}
</string>
</property>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="profileLabel">
<property name="styleSheet">
<string notr="true">#profileLabel {
font-size: 18pt;
font-family: &quot;EB Garamond&quot;, &quot;EB Garamond 08&quot;;
}
</string>
</property>
<property name="text">
<string>Current Profile:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="playButton">
<property name="minimumSize">
<size>
<width>200</width>
<height>85</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>85</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#playButton {
height: 50px;
margin-bottom: 30px;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1,
stop:0 rgba(255, 255, 255, 200),
stop:0.1 rgba(255, 255, 255, 15),
stop:0.49 rgba(255, 255, 255, 75),
stop:0.5 rgba(0, 0, 0, 0),
stop:0.9 rgba(0, 0, 0, 55),
stop:1 rgba(0, 0, 0, 100));
font-size: 26pt;
font-family: &quot;EB Garamond&quot;, &quot;EB Garamond 08&quot;;
color: black;
border-right: 1px solid rgba(0, 0, 0, 155);
border-left: 1px solid rgba(0, 0, 0, 55);
border-top: 1px solid rgba(0, 0, 0, 55);
border-bottom: 1px solid rgba(0, 0, 0, 155);
border-radius: 5px;
}
#playButton:hover {
border-bottom: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(164, 192, 228, 255), stop:1 rgba(255, 255, 255, 0));
border-top: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(164, 192, 228, 255), stop:1 rgba(255, 255, 255, 0));
border-right: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(164, 192, 228, 255), stop:1 rgba(255, 255, 255, 0));
border-left: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(164, 192, 228, 255), stop:1 rgba(255, 255, 255, 0));
border-width: 2px;
border-style: solid;
}
#playButton:pressed {
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 rgba(0, 0, 0, 75),
stop:0.1 rgba(0, 0, 0, 15),
stop:0.2 rgba(255, 255, 255, 55)
stop:0.95 rgba(255, 255, 255, 55),
stop:1 rgba(255, 255, 255, 155));
border: 1px solid rgba(0, 0, 0, 55);
}</string>
</property>
<property name="text">
<string>Play</string>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>

Loading…
Cancel
Save