Added stylesheet implementation for the Play tab
@ -6,22 +6,31 @@
|
||||
#include "datafilespage.hpp"
|
||||
|
||||
MainDialog::MainDialog()
|
||||
{
|
||||
{
|
||||
// TODO: Should be an install path
|
||||
QFile file("apps/launcher/resources/launcher.qss");
|
||||
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
qDebug() << styleSheet;
|
||||
setStyleSheet(styleSheet);
|
||||
|
||||
mIconWidget = new QListWidget;
|
||||
mIconWidget->setViewMode(QListView::IconMode);
|
||||
mIconWidget->setWrapping(false);
|
||||
|
||||
mIconWidget->setStyleSheet("QListWidget { background-image: url(background.png); background-color: white; background-repeat: no-repeat; background-attachment: scroll; background-position: right; } QListWidgetItem { alignment: center; }");
|
||||
mIconWidget->setObjectName("IconWidget");
|
||||
qDebug() << mIconWidget->objectName();
|
||||
|
||||
mIconWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Just to be sure
|
||||
|
||||
|
||||
//mIconWidget->setItemDelegate(new ListViewDelegate());
|
||||
mIconWidget->setAttribute(Qt::WA_MacShowFocusRect); // Show a focus frame around the icons on Mac
|
||||
//mIconWidget->setLayoutMode(QListView::SinglePass);
|
||||
mIconWidget->setUniformItemSizes(true);
|
||||
|
||||
|
||||
mIconWidget->setIconSize(QSize(48, 48));
|
||||
mIconWidget->setMovement(QListView::Static);
|
||||
|
||||
|
||||
mIconWidget->setMinimumWidth(400);
|
||||
mIconWidget->setFixedHeight(80);
|
||||
mIconWidget->setSpacing(4);
|
||||
@ -31,28 +40,28 @@ MainDialog::MainDialog()
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox(this);
|
||||
QVBoxLayout *groupLayout = new QVBoxLayout(groupBox);
|
||||
|
||||
|
||||
// TODO: TESTING
|
||||
|
||||
|
||||
/*mProfileModel = new QStringListModel();
|
||||
QStringList profileList;
|
||||
profileList << "Default" << "Warrior" << "Redemption" << "Cool stuff bro!";
|
||||
mProfileModel->setStringList(profileList);
|
||||
*/
|
||||
|
||||
|
||||
// Various pages
|
||||
mPlayPage = new PlayPage(this);
|
||||
//mPlayPage->mProfileModel->setStringList(profileList);
|
||||
|
||||
|
||||
mDataFilesPage = new DataFilesPage(this);
|
||||
//mDataFilesPage->mProfileComboBox->setModel(mProfileModel);
|
||||
|
||||
|
||||
mPagesWidget = new QStackedWidget(groupBox);
|
||||
mPagesWidget->addWidget(mPlayPage);
|
||||
mPagesWidget->addWidget(new PlayPage);
|
||||
mPagesWidget->addWidget(mDataFilesPage);
|
||||
//mPagesWidget->addWidget(new QueryPage);
|
||||
|
||||
|
||||
groupLayout->addWidget(mPagesWidget);
|
||||
|
||||
QPushButton *playButton = new QPushButton(tr("Play"));
|
||||
@ -60,36 +69,36 @@ MainDialog::MainDialog()
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Close);
|
||||
buttonBox->addButton(playButton, QDialogButtonBox::ActionRole);
|
||||
|
||||
|
||||
//QSpacerItem *vSpacer1 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
|
||||
QVBoxLayout *dialogLayout = new QVBoxLayout(this);
|
||||
dialogLayout->addWidget(mIconWidget);
|
||||
//dialogLayout->addItem(vSpacer1);
|
||||
dialogLayout->addWidget(groupBox);
|
||||
|
||||
|
||||
dialogLayout->addWidget(buttonBox);
|
||||
//mainLayout->addStretch(1);
|
||||
//mainLayout->addSpacing(12);
|
||||
|
||||
setWindowTitle(tr("OpenMW Launcher"));
|
||||
setMinimumSize(QSize(550, 450));
|
||||
|
||||
|
||||
createIcons();
|
||||
}
|
||||
|
||||
void MainDialog::createIcons()
|
||||
{
|
||||
//QSize itemSize(80, 66);
|
||||
|
||||
|
||||
QListWidgetItem *configButton = new QListWidgetItem(mIconWidget);
|
||||
configButton->setIcon(QIcon(":resources/openmw-icon.png"));
|
||||
configButton->setIcon(QIcon(":/images/openmw-icon.png"));
|
||||
configButton->setText(tr("Play"));
|
||||
configButton->setTextAlignment(Qt::AlignCenter);
|
||||
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
//configButton->setSizeHint(itemSize);
|
||||
|
||||
|
||||
QListWidgetItem *updateButton = new QListWidgetItem(mIconWidget);
|
||||
updateButton->setIcon(QIcon::fromTheme("video-display"));
|
||||
updateButton->setText(tr("Graphics"));
|
||||
@ -97,15 +106,15 @@ void MainDialog::createIcons()
|
||||
updateButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
//updateButton->setSizeHint(itemSize);
|
||||
|
||||
|
||||
QListWidgetItem *queryButton = new QListWidgetItem(mIconWidget);
|
||||
queryButton->setIcon(QIcon(":resources/openmw-plugin-icon.png"));
|
||||
queryButton->setIcon(QIcon(":/images/openmw-plugin-icon.png"));
|
||||
queryButton->setText(tr("Data Files"));
|
||||
queryButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
||||
queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
//queryButton->setSizeHint(itemSize);
|
||||
|
||||
|
||||
connect(mIconWidget,
|
||||
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
|
||||
@ -117,17 +126,17 @@ void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||
current = previous;
|
||||
|
||||
mPagesWidget->setCurrentIndex(mIconWidget->row(current));
|
||||
|
||||
|
||||
if (previous) {
|
||||
QString previousPage = previous->data(Qt::DisplayRole).toString();
|
||||
QString currentPage = current->data(Qt::DisplayRole).toString();
|
||||
|
||||
|
||||
// The user switched from Data Files to Play
|
||||
if (previousPage == QString("Data Files") && currentPage == QString("Play")) {
|
||||
mPlayPage->mProfileModel->setStringList(mDataFilesPage->mProfileModel->stringList());
|
||||
mPlayPage->mProfileComboBox->setCurrentIndex(mDataFilesPage->mProfileComboBox->currentIndex());
|
||||
}
|
||||
|
||||
|
||||
// The user switched from Play to Data Files
|
||||
if (previousPage == QString("Play") && currentPage == QString("Data Files")) {
|
||||
mDataFilesPage->mProfileComboBox->setCurrentIndex(mPlayPage->mProfileComboBox->currentIndex());
|
||||
|
@ -4,30 +4,140 @@
|
||||
|
||||
PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
QPushButton *playButton = new QPushButton(tr("Play"));
|
||||
playButton->setMinimumSize(QSize(150, 50));
|
||||
|
||||
// TEST
|
||||
|
||||
QGroupBox *playBox = new QGroupBox(this);
|
||||
playBox->setObjectName("PlayBox");
|
||||
playBox->setFixedSize(QSize(425, 375));
|
||||
playBox->setFlat(true);
|
||||
|
||||
QVBoxLayout *playLayout = new QVBoxLayout(playBox);
|
||||
|
||||
QPushButton *playButton = new QPushButton(tr("Play"), playBox);
|
||||
playButton->setObjectName("PlayButton");
|
||||
//playButton->setMinimumSize(QSize(150, 50));
|
||||
|
||||
QLabel *profileLabel = new QLabel(tr("Current Profile:"), playBox);
|
||||
profileLabel->setObjectName("ProfileLabel");
|
||||
|
||||
// TODO: Cleanup
|
||||
mProfileModel = new QStringListModel();
|
||||
QStringList profileList;
|
||||
profileList << "Other" << "Bla" << "No" << "SEGFAULT!";
|
||||
mProfileModel->setStringList(profileList);
|
||||
|
||||
mProfileComboBox = new QComboBox(this);
|
||||
|
||||
mProfileComboBox = new QComboBox(playBox);
|
||||
mProfileComboBox->setObjectName("ProfileComboBox");
|
||||
//mProfileComboBox->setMinimumWidth(200);
|
||||
mProfileComboBox->setModel(mProfileModel);
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
||||
QSpacerItem *hSpacer1 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
QSpacerItem *hSpacer2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
buttonLayout->addItem(hSpacer1);
|
||||
buttonLayout->addWidget(playButton);
|
||||
buttonLayout->addItem(hSpacer2);
|
||||
|
||||
QVBoxLayout *pageLayout = new QVBoxLayout(this);
|
||||
|
||||
pageLayout->addLayout(buttonLayout);
|
||||
pageLayout->addWidget(mProfileComboBox);
|
||||
|
||||
}
|
||||
|
||||
QSpacerItem *vSpacer1 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
QSpacerItem *vSpacer2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
playLayout->addItem(vSpacer1);
|
||||
playLayout->addWidget(playButton);
|
||||
playLayout->addWidget(profileLabel);
|
||||
playLayout->addWidget(mProfileComboBox);
|
||||
playLayout->addItem(vSpacer2);
|
||||
|
||||
QHBoxLayout *pageLayout = new QHBoxLayout(this);
|
||||
QSpacerItem *hSpacer1 = new QSpacerItem(54, 90, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
QSpacerItem *hSpacer2 = new QSpacerItem(54, 90, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
pageLayout->addItem(hSpacer1);
|
||||
pageLayout->addWidget(playBox);
|
||||
pageLayout->addItem(hSpacer2);
|
||||
|
||||
}
|
||||
// verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));
|
||||
// listWidget = new QListWidget(Dialog);
|
||||
// listWidget->setObjectName(QString::fromUtf8("listWidget"));
|
||||
// listWidget->setMaximumSize(QSize(16777215, 100));
|
||||
//
|
||||
// verticalLayout_2->addWidget(listWidget);
|
||||
//
|
||||
// groupBox = new QGroupBox(Dialog);
|
||||
// groupBox->setObjectName(QString::fromUtf8("groupBox"));
|
||||
// gridLayout_2 = new QGridLayout(groupBox);
|
||||
// gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
|
||||
// verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
//
|
||||
// gridLayout_2->addItem(verticalSpacer_2, 0, 1, 1, 1);
|
||||
//
|
||||
// horizontalSpacer_4 = new QSpacerItem(54, 90, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
//
|
||||
// gridLayout_2->addItem(horizontalSpacer_4, 1, 0, 1, 1);
|
||||
//
|
||||
// horizontalSpacer_3 = new QSpacerItem(53, 90, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
//
|
||||
// gridLayout_2->addItem(horizontalSpacer_3, 1, 2, 1, 1);
|
||||
//
|
||||
// verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
//
|
||||
// gridLayout_2->addItem(verticalSpacer_3, 2, 1, 1, 1);
|
||||
//
|
||||
// groupBox_2 = new QGroupBox(groupBox);
|
||||
// groupBox_2->setObjectName(QString::fromUtf8("groupBox_2"));
|
||||
// groupBox_2->setMinimumSize(QSize(404, 383));
|
||||
// groupBox_2->setMaximumSize(QSize(404, 383));
|
||||
//
|
||||
// groupBox_2->setFlat(true);
|
||||
// verticalLayout = new QVBoxLayout(groupBox_2);
|
||||
// verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
||||
// gridLayout = new QGridLayout();
|
||||
// gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
// label = new QLabel(groupBox_2);
|
||||
// label->setObjectName(QString::fromUtf8("label"));
|
||||
// label->setStyleSheet(QString::fromUtf8(""));
|
||||
//
|
||||
// gridLayout->addWidget(label, 2, 1, 1, 1);
|
||||
//
|
||||
// comboBox = new QComboBox(groupBox_2);
|
||||
// comboBox->setObjectName(QString::fromUtf8("comboBox"));
|
||||
// comboBox->setMinimumSize(QSize(200, 0));
|
||||
// comboBox->setStyleSheet(QString::fromUtf8(""));
|
||||
//
|
||||
// gridLayout->addWidget(comboBox, 3, 1, 1, 1);
|
||||
//
|
||||
// horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
//
|
||||
// gridLayout->addItem(horizontalSpacer, 2, 2, 1, 1);
|
||||
//
|
||||
// horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
//
|
||||
// gridLayout->addItem(horizontalSpacer_2, 2, 0, 1, 1);
|
||||
//
|
||||
// verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
//
|
||||
// gridLayout->addItem(verticalSpacer, 1, 1, 1, 1);
|
||||
//
|
||||
// verticalSpacer_4 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
//
|
||||
// gridLayout->addItem(verticalSpacer_4, 4, 1, 1, 1);
|
||||
//
|
||||
// pushButton = new QPushButton(groupBox_2);
|
||||
// pushButton->setObjectName(QString::fromUtf8("pushButton"));
|
||||
// pushButton->setMinimumSize(QSize(200, 50));
|
||||
// pushButton->setMaximumSize(QSize(16777215, 16777215));
|
||||
// pushButton->setAutoFillBackground(false);
|
||||
// pushButton->setStyleSheet(QString::fromUtf8(""));
|
||||
// pushButton->setIconSize(QSize(32, 32));
|
||||
// pushButton->setAutoRepeat(false);
|
||||
// pushButton->setFlat(false);
|
||||
//
|
||||
// gridLayout->addWidget(pushButton, 0, 1, 1, 1);
|
||||
//
|
||||
//
|
||||
// verticalLayout->addLayout(gridLayout);
|
||||
//
|
||||
//
|
||||
// gridLayout_2->addWidget(groupBox_2, 1, 1, 1, 1);
|
||||
//
|
||||
//
|
||||
// verticalLayout_2->addWidget(groupBox);
|
||||
//
|
||||
// buttonBox = new QDialogButtonBox(Dialog);
|
||||
// buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
|
||||
// buttonBox->setOrientation(Qt::Horizontal);
|
||||
// buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
//
|
||||
// verticalLayout_2->addWidget(buttonBox);
|
||||
//
|
||||
//
|
||||
|
@ -1,8 +1,10 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>resources/clear.png</file>
|
||||
<file>resources/openmw-icon.png</file>
|
||||
<file>resources/openmw-plugin-icon.png</file>
|
||||
<file>resources/openmw-header.png</file>
|
||||
<qresource prefix="/images">
|
||||
<file alias="clear.png">resources/images/clear.png</file>
|
||||
<file alias="down.png">resources/images/down.png</file>
|
||||
<file alias="openmw-icon.png">resources/images/openmw-icon.png</file>
|
||||
<file alias="openmw-plugin-icon.png">resources/images/openmw-plugin-icon.png</file>
|
||||
<file alias="openmw-header.png">resources/images/openmw-header.png</file>
|
||||
<file alias="playpage-background.png">resources/images/playpage-background.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 644 B |
BIN
apps/launcher/resources/images/down.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
apps/launcher/resources/images/openmw-header.png
Normal file
After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
BIN
apps/launcher/resources/images/playpage-background.png
Normal file
After Width: | Height: | Size: 233 KiB |
119
apps/launcher/resources/launcher.qss
Normal file
@ -0,0 +1,119 @@
|
||||
QGroupBox#PlayBox {
|
||||
background-image: url(":/images/playpage-background.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: top;
|
||||
padding-top: 100px;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
QPushButton#PlayButton {
|
||||
|
||||
width: 200px;
|
||||
max-width: 200px;
|
||||
height: 50px;
|
||||
|
||||
margin-left: 90%;
|
||||
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: 24pt "Gauntlet Thin";
|
||||
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;
|
||||
}
|
||||
|
||||
QPushButton#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;
|
||||
}
|
||||
|
||||
QPushButton#PlayButton:pressed {
|
||||
|
||||
}
|
||||
|
||||
QLabel#ProfileLabel
|
||||
{
|
||||
margin-left: 90%;
|
||||
font: 14pt "Gauntlet Classic";
|
||||
}
|
||||
|
||||
|
||||
QComboBox#ProfileComboBox
|
||||
{
|
||||
width: 180px;
|
||||
max-width: 200px;
|
||||
height: 20px;
|
||||
|
||||
margin-left: 90%;
|
||||
padding: 1px 18px 1px 3px;
|
||||
|
||||
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 gray, stop:0.2 white, stop:1 rgba(255, 255, 255, 55));
|
||||
border-width: 1px;
|
||||
border-color: rgba(0, 0, 0, 125);
|
||||
border-style: solid;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* QComboBox gets the "on" state when the popup is open * /
|
||||
QComboBox:!editable:on, QComboBox::drop-down:editable:on {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #D3D3D3, stop: 0.4 #D8D8D8,
|
||||
stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1);
|
||||
}*/
|
||||
|
||||
|
||||
QComboBox#ProfileComboBox:on { /* shift the text when the popup opens */
|
||||
padding-top: 3px;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
QComboBox#ProfileComboBox::drop-down {
|
||||
subcontrol-origin: padding;
|
||||
subcontrol-position: top right;
|
||||
|
||||
border-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-left-color: darkgray;
|
||||
border-left-style: solid; /* just a single line */
|
||||
border-top-right-radius: 3px; /* same radius as the QComboBox */
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
|
||||
QComboBox#ProfileComboBox::down-arrow {
|
||||
image: url(":/images/down.png");
|
||||
}
|
||||
|
||||
QComboBox#ProfileComboBox::down-arrow:on { /* shift the arrow when popup is open */
|
||||
top: 1px;
|
||||
left: 1px;
|
||||
}
|
||||
|
||||
QListWidget#IconWidget {
|
||||
background-image: url(":/images/openmw-header.png");
|
||||
background-color: white;
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: scroll;
|
||||
background-position: right;
|
||||
}
|
||||
|
||||
QListWidgetItem {
|
||||
alignment: center;
|
||||
}
|
Before Width: | Height: | Size: 106 KiB |