Skip to content

Commit

Permalink
Add GZH-like theme to the start widget
Browse files Browse the repository at this point in the history
  • Loading branch information
MahBoiDeveloper committed Apr 19, 2024
1 parent 1bfacca commit 3a7e196
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 45 deletions.
1 change: 1 addition & 0 deletions src/GUI/BaseConfigurationDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ BaseConfigurationDialog::BaseConfigurationDialog(QWidget* parent) : QDialog(pare
dialogButtons.setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
dialogButtons.button(QDialogButtonBox::Ok)->setText(tr("Configure"));
dialogButtons.button(QDialogButtonBox::Cancel)->setText(tr("Back"));
dialogButtons.setContentsMargins(0, 0, 0, 30);

// emit accepted configurations
connect(&dialogButtons, &QDialogButtonBox::accepted, this, [=]()
Expand Down
2 changes: 1 addition & 1 deletion src/GUI/GUIConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GUIConfig
inline static const int ICON_MIN_HEIGHT = 80;
inline static const int ICON_SCALING_HEIGHT = 25;
inline static const QString ICONS_FOLDER = Config::RESOURCE_FOLDER + "/Icons";
inline static const QString QT_ICONS_FOLDER = ":/my/icons";
inline static const QString QT_ICONS_FOLDER = ":/icons";
inline static const QString MISSING_ICON_PATH = QT_ICONS_FOLDER + "/NoImageSmall.webp";
inline static const QString EDITOR_ICON_PATH = QT_ICONS_FOLDER + "/EditorIconSmall.webp";
inline static const QString EDITOR_BIG_ICON_PATH = QT_ICONS_FOLDER + "/EditorIconBig.webp";
Expand Down
54 changes: 27 additions & 27 deletions src/GUI/GreetingWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ GreetingWidget::GreetingWidget(Config::Languages language, QWidget* parent) : QW

// Makes greeting window unresizeable
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

// Program description
lblGreeting = new QLabel(tr("Greetings, %username%. "
"You have launched the hotkey editing program "
"for the game Command and Conquer: Generals "
"and Command and Conquer: Generals — Zero Hour. "
"At the moment, the program supports in test mode "
"only the creation of hotkey maps based on pre-prepared hotkeys. "
"We hope that you will like the program."));
lblGreeting->setWordWrap(true);
lblGreeting->setAlignment(Qt::AlignmentFlag::AlignJustify);
lblGreeting->setFixedWidth(GetGreetingTextAverageSize(lblGreeting->text()) + 50);

// Add "New Project" and "Load Project" buttons to the window
btnNewProject = new QPushButton(tr("New Project"));
Expand All @@ -49,18 +37,6 @@ GreetingWidget::GreetingWidget(Config::Languages language, QWidget* parent) : QW
emit pressed(GreetingWidget::StandartButtons::LoadProject);
});

ltButtons = new QVBoxLayout();
ltButtons->setSpacing(50);
ltButtons->setAlignment(Qt::AlignTop);
ltButtons->addWidget(btnNewProject);
ltButtons->addWidget(btnLoadProject);

ltContent = new QHBoxLayout();
ltContent->setAlignment(Qt::AlignLeft);
ltContent->addLayout(ltButtons);
ltContent->addWidget(lblGreeting);
ltContent->setAlignment(lblGreeting, Qt::AlignTop);

lblLanguage = new QLabel(tr("Language"));

cmbLangList = new QComboBox();
Expand All @@ -75,12 +51,36 @@ GreetingWidget::GreetingWidget(Config::Languages language, QWidget* parent) : QW
ltLanguages->addWidget(lblLanguage);
ltLanguages->addWidget(cmbLangList);

ltButtons = new QVBoxLayout();
ltButtons->setSpacing(50);
ltButtons->setAlignment(Qt::AlignTop);
ltButtons->addWidget(btnNewProject);
ltButtons->addWidget(btnLoadProject);
ltButtons->setSpacing(30);
ltButtons->addLayout(ltLanguages);

// Program description
lblGreeting = new QLabel(tr("Greetings, %username%. "
"You have launched the hotkey editing program "
"for the game Command and Conquer: Generals "
"and Command and Conquer: Generals — Zero Hour. "
"At the moment, the program supports in test mode "
"only the creation of hotkey maps based on pre-prepared hotkeys. "
"We hope that you will like the program."));
lblGreeting->setWordWrap(true);
lblGreeting->setAlignment(Qt::AlignVCenter);
lblGreeting->setFixedWidth(GetGreetingTextAverageSize(lblGreeting->text()) + 50);

ltContent = new QHBoxLayout();
ltContent->setAlignment(Qt::AlignLeft);
ltContent->addLayout(ltButtons);
ltContent->addWidget(lblGreeting);
ltContent->setAlignment(lblGreeting, Qt::AlignTop);

ltMain = new QVBoxLayout();
ltMain->setSpacing(50);
ltMain->setContentsMargins(50, 50, 50, 30);
ltMain->setContentsMargins(50, 50, 50, 86);
ltMain->addLayout(ltContent);
ltMain->addSpacing(80);
ltMain->addLayout(ltLanguages);

setLayout(ltMain);
}
Expand Down
2 changes: 1 addition & 1 deletion src/GUI/LaunchWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
LaunchWidget::LaunchWidget(Config::Languages lngType, QWidget* parent) : QStackedWidget(parent)
{
// Application style settings
QFile styleSheetsFile{":/my/css/MainStyleSheet.css"};
QFile styleSheetsFile{":/css/MainStyleSheet.css"};

if (styleSheetsFile.open(QIODevice::ReadOnly))
{
Expand Down
5 changes: 2 additions & 3 deletions src/GUI/QtSources/CompilationSources.qrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<RCC>
<qresource prefix="/my/css">
<qresource prefix="css">
<file>MainStyleSheet.css</file>
</qresource>
<qresource prefix="/my/icons">
<file>mainmenuruleruserinterface.png</file>
<qresource prefix="icons">
<file>EditorIconSmall.webp</file>
<file>EditorIconBig.webp</file>
<file>NoImageSmall.webp</file>
Expand Down
32 changes: 23 additions & 9 deletions src/GUI/QtSources/mainStyleSheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
{
font-family: "Consolas";
font-size: 11pt;
color: white;
}

QPushButton
GreetingWidget QPushButton, LoadDialog QPushButton, CreationDialog QPushButton
{
padding: 10px;

Expand All @@ -17,28 +18,41 @@ QPushButton
border-radius: 3px;
}

QPushButton:hover
GreetingWidget QPushButton:hover, LoadDialog QPushButton:hover, CreationDialog QPushButton:hover
{
background-color: #b1b7ff;
border-color: #3543e7;
color: black;
}

LoadDialog
QComboBox
{
background-image: url(:/my/icons/mainmenuruleruserinterface.png);
width: 80px;
color: white;
background-color: #3543e7;

border-style: outset;
border-width: 2px;
border-color: #b1b7ff;
border-radius: 3px;
}

LaunchWidget
QComboBox::drop-down
{
background-image: url(:/my/icons/mainmenuruleruserinterface.png);
color: black;
}

CreationDialog
LoadDialog, LaunchWidget, CreationDialog
{
background-image: url(:/my/icons/mainmenuruleruserinterface.png);
background-image: url(Resources/Icons/StartMenuBackground.png);
background-color: black;
}

/* HotkeysMainWindow, ActionHotkeyWidget, HotkeysMainWindow#QVBoxLayout, HotkeysMainWindow#QHBoxLayout
{
background-color: black;
color: white;
} */

BaseConfigurationDialog QPushButton
{
padding-left: 30px;
Expand Down
Binary file removed src/GUI/QtSources/mainmenuruleruserinterface.png
Binary file not shown.
Binary file added src/GUI/icons/StartMenuBackground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/GUI/icons/mainmenuruleruserinterface.png
Binary file not shown.
8 changes: 4 additions & 4 deletions src/GUI/translations/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@
<translation type="vanished">Загрузить проект</translation>
</message>
<message>
<location filename="../GreetingWidget.cpp" line="38"/>
<location filename="../GreetingWidget.cpp" line="26"/>
<source>New Project</source>
<translation>Новый проект</translation>
</message>
<message>
<location filename="../GreetingWidget.cpp" line="45"/>
<location filename="../GreetingWidget.cpp" line="33"/>
<source>Load Project</source>
<translation>Загрузить проект</translation>
</message>
<message>
<location filename="../GreetingWidget.cpp" line="64"/>
<location filename="../GreetingWidget.cpp" line="40"/>
<source>Language</source>
<translation>Язык</translation>
</message>
<message>
<location filename="../GreetingWidget.cpp" line="26"/>
<location filename="../GreetingWidget.cpp" line="63"/>
<source>Greetings, %username%. You have launched the hotkey editing program for the game Command and Conquer: Generals and Command and Conquer: Generals — Zero Hour. At the moment, the program supports in test mode only the creation of hotkey maps based on pre-prepared hotkeys. We hope that you will like the program.</source>
<translation>Приветствую тебя, %username%. Ты запустил программу редактирования горячих клавиш для игры Command and Conquer: Generals и Command and Conquer: Generals — Zero Hour. На текущий момент программа поддерживает в тестовом режиме только создание карт горячих клавиш на основе заранее подготовленных горячих клавиш. Надеемся, что программа тебе понравится.</translation>
</message>
Expand Down

0 comments on commit 3a7e196

Please sign in to comment.