Refactoring
This commit is contained in:
@@ -42,14 +42,17 @@
|
||||
# include "moodbar/moodbarrenderer.h"
|
||||
#endif
|
||||
|
||||
#include "constants/moodbarsettings.h"
|
||||
#include "moodbarsettingspage.h"
|
||||
#include "ui_moodbarsettingspage.h"
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
using namespace MoodbarSettings;
|
||||
|
||||
const char *MoodbarSettingsPage::kSettingsGroup = "Moodbar";
|
||||
const int MoodbarSettingsPage::kMoodbarPreviewWidth = 150;
|
||||
const int MoodbarSettingsPage::kMoodbarPreviewHeight = 18;
|
||||
namespace {
|
||||
constexpr int kMoodbarPreviewWidth = 150;
|
||||
constexpr int kMoodbarPreviewHeight = 18;
|
||||
}
|
||||
|
||||
MoodbarSettingsPage::MoodbarSettingsPage(SettingsDialog *dialog, QWidget *parent)
|
||||
: SettingsPage(dialog, parent),
|
||||
@@ -69,10 +72,10 @@ void MoodbarSettingsPage::Load() {
|
||||
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
ui_->moodbar_enabled->setChecked(s.value("enabled", false).toBool());
|
||||
ui_->moodbar_show->setChecked(s.value("show", false).toBool());
|
||||
ui_->moodbar_style->setCurrentIndex(s.value("style", 0).toInt());
|
||||
ui_->moodbar_save->setChecked(s.value("save", false).toBool());
|
||||
ui_->moodbar_enabled->setChecked(s.value(kEnabled, false).toBool());
|
||||
ui_->moodbar_show->setChecked(s.value(kShow, false).toBool());
|
||||
ui_->moodbar_style->setCurrentIndex(s.value(kStyle, 0).toInt());
|
||||
ui_->moodbar_save->setChecked(s.value(kSave, false).toBool());
|
||||
s.endGroup();
|
||||
|
||||
InitMoodbarPreviews();
|
||||
@@ -87,10 +90,10 @@ void MoodbarSettingsPage::Save() {
|
||||
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("enabled", ui_->moodbar_enabled->isChecked());
|
||||
s.setValue("show", ui_->moodbar_show->isChecked());
|
||||
s.setValue("style", ui_->moodbar_style->currentIndex());
|
||||
s.setValue("save", ui_->moodbar_save->isChecked());
|
||||
s.setValue(kEnabled, ui_->moodbar_enabled->isChecked());
|
||||
s.setValue(kShow, ui_->moodbar_show->isChecked());
|
||||
s.setValue(kStyle, ui_->moodbar_style->currentIndex());
|
||||
s.setValue(kSave, ui_->moodbar_save->isChecked());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
@@ -114,9 +117,9 @@ void MoodbarSettingsPage::InitMoodbarPreviews() {
|
||||
file.close();
|
||||
|
||||
// Render and set each preview
|
||||
for (int i = 0; i < static_cast<int>(MoodbarRenderer::MoodbarStyle::StyleCount); ++i) {
|
||||
for (int i = 0; i < static_cast<int>(Style::StyleCount); ++i) {
|
||||
|
||||
const MoodbarRenderer::MoodbarStyle style = static_cast<MoodbarRenderer::MoodbarStyle>(i);
|
||||
const Style style = static_cast<Style>(i);
|
||||
const ColorVector colors = MoodbarRenderer::Colors(file_data, style, palette());
|
||||
|
||||
QPixmap pixmap(preview_size);
|
||||
|
||||
Reference in New Issue
Block a user