diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 1bb8f1d592..840337ae8c 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -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()); diff --git a/apps/launcher/playpage.cpp b/apps/launcher/playpage.cpp index 18360ffc6e..d48006b89c 100644 --- a/apps/launcher/playpage.cpp +++ b/apps/launcher/playpage.cpp @@ -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); - -} \ No newline at end of file + + 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); +// +// diff --git a/apps/launcher/resources.qrc b/apps/launcher/resources.qrc index 9a36dfd36d..d1c4513932 100644 --- a/apps/launcher/resources.qrc +++ b/apps/launcher/resources.qrc @@ -1,8 +1,10 @@ - - resources/clear.png - resources/openmw-icon.png - resources/openmw-plugin-icon.png - resources/openmw-header.png + + resources/images/clear.png + resources/images/down.png + resources/images/openmw-icon.png + resources/images/openmw-plugin-icon.png + resources/images/openmw-header.png + resources/images/playpage-background.png diff --git a/apps/launcher/resources/clear.png b/apps/launcher/resources/images/clear.png similarity index 100% rename from apps/launcher/resources/clear.png rename to apps/launcher/resources/images/clear.png diff --git a/apps/launcher/resources/images/down.png b/apps/launcher/resources/images/down.png new file mode 100644 index 0000000000..f529cda7de Binary files /dev/null and b/apps/launcher/resources/images/down.png differ diff --git a/apps/launcher/resources/images/openmw-header.png b/apps/launcher/resources/images/openmw-header.png new file mode 100644 index 0000000000..a168d4d2a8 Binary files /dev/null and b/apps/launcher/resources/images/openmw-header.png differ diff --git a/apps/launcher/resources/openmw-icon.png b/apps/launcher/resources/images/openmw-icon.png similarity index 100% rename from apps/launcher/resources/openmw-icon.png rename to apps/launcher/resources/images/openmw-icon.png diff --git a/apps/launcher/resources/openmw-plugin-icon.png b/apps/launcher/resources/images/openmw-plugin-icon.png similarity index 100% rename from apps/launcher/resources/openmw-plugin-icon.png rename to apps/launcher/resources/images/openmw-plugin-icon.png diff --git a/apps/launcher/resources/openmw_icon.ico b/apps/launcher/resources/images/openmw_icon.ico similarity index 100% rename from apps/launcher/resources/openmw_icon.ico rename to apps/launcher/resources/images/openmw_icon.ico diff --git a/apps/launcher/resources/images/playpage-background.png b/apps/launcher/resources/images/playpage-background.png new file mode 100644 index 0000000000..7eb84b6a73 Binary files /dev/null and b/apps/launcher/resources/images/playpage-background.png differ diff --git a/apps/launcher/resources/launcher.qss b/apps/launcher/resources/launcher.qss new file mode 100644 index 0000000000..1fc3861fe4 --- /dev/null +++ b/apps/launcher/resources/launcher.qss @@ -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; +} diff --git a/apps/launcher/resources/openmw-header.png b/apps/launcher/resources/openmw-header.png deleted file mode 100644 index a3045ce615..0000000000 Binary files a/apps/launcher/resources/openmw-header.png and /dev/null differ