Move progress bar style into constexpr strings

This commit is contained in:
James Rowe 2019-01-20 18:20:21 -07:00
parent 63783db1b3
commit 4bce57b149
1 changed files with 41 additions and 37 deletions

View File

@ -28,6 +28,43 @@
#include <QMovie> #include <QMovie>
#endif #endif
constexpr const char* PROGRESSBAR_STYLE_PREPARE = R"(
QProgressBar {}
QProgressBar::chunk {})";
constexpr const char* PROGRESSBAR_STYLE_RAW = R"(
QProgressBar {
background-color: black;
border: 2px solid white;
border-radius: 4px;
padding: 2px;
}
QProgressBar::chunk {
background-color: #0ab9e6;
})";
constexpr const char* PROGRESSBAR_STYLE_BINARY = R"(
QProgressBar {
background-color: black;
border: 2px solid white;
border-radius: 4px;
padding: 2px;
}
QProgressBar::chunk {
background-color: #ff3c28;
})";
constexpr const char* PROGRESSBAR_STYLE_COMPLETE = R"(
QProgressBar {
background-color: black;
border: 2px solid white;
border-radius: 4px;
padding: 2px;
}
QProgressBar::chunk {
background-color: #ff3c28;
})";
LoadingScreen::LoadingScreen(QWidget* parent) LoadingScreen::LoadingScreen(QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::LoadingScreen>()), : QWidget(parent), ui(std::make_unique<Ui::LoadingScreen>()),
previous_stage(VideoCore::LoadCallbackStage::Complete) { previous_stage(VideoCore::LoadCallbackStage::Complete) {
@ -44,43 +81,10 @@ LoadingScreen::LoadingScreen(QWidget* parent)
{VideoCore::LoadCallbackStage::Complete, tr("Launching...")}, {VideoCore::LoadCallbackStage::Complete, tr("Launching...")},
}; };
progressbar_style = { progressbar_style = {
{VideoCore::LoadCallbackStage::Prepare, {VideoCore::LoadCallbackStage::Prepare, PROGRESSBAR_STYLE_PREPARE},
R"( {VideoCore::LoadCallbackStage::Raw, PROGRESSBAR_STYLE_RAW},
QProgressBar {} {VideoCore::LoadCallbackStage::Binary, PROGRESSBAR_STYLE_BINARY},
QProgressBar::chunk {})"}, {VideoCore::LoadCallbackStage::Complete, PROGRESSBAR_STYLE_COMPLETE},
{VideoCore::LoadCallbackStage::Raw,
R"(
QProgressBar {
background-color: black;
border: 2px solid white;
border-radius: 4px;
padding: 2px;
}
QProgressBar::chunk {
background-color: #0ab9e6;
})"},
{VideoCore::LoadCallbackStage::Binary,
R"(
QProgressBar {
background-color: black;
border: 2px solid white;
border-radius: 4px;
padding: 2px;
}
QProgressBar::chunk {
background-color: #ff3c28;
})"},
{VideoCore::LoadCallbackStage::Complete,
R"(
QProgressBar {
background-color: black;
border: 2px solid white;
border-radius: 4px;
padding: 2px;
}
QProgressBar::chunk {
background-color: #ff3c28;
})"},
}; };
} }