Skip to content

Commit

Permalink
DlgPrefInterface: show skin preview screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Apr 3, 2018
1 parent 9f96292 commit 80f9c8a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/preferences/dialog/dlgprefinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ DlgPrefInterface::DlgPrefInterface(QWidget * parent, MixxxMainWindow * mixxx,
warningLabel->setText(warningString);

ComboBoxSkinconf->clear();
skinPreviewLabel->setText("");

QList<QDir> skinSearchPaths = m_pSkinLoader->getSkinSearchPaths();
QList<QFileInfo> skins;
Expand All @@ -104,6 +105,7 @@ DlgPrefInterface::DlgPrefInterface(QWidget * parent, MixxxMainWindow * mixxx,
if (skinInfo.absoluteFilePath() == configuredSkinPath) {
m_skin = skinInfo.fileName();
ComboBoxSkinconf->setCurrentIndex(index);
skinPreviewLabel->setPixmap(m_pSkinLoader->getSkinPreview(m_skin));
if (size_ok) {
warningLabel->hide();
} else {
Expand Down Expand Up @@ -319,6 +321,7 @@ void DlgPrefInterface::slotSetScheme(int) {

void DlgPrefInterface::slotSetSkin(int) {
QString newSkin = ComboBoxSkinconf->currentText();
skinPreviewLabel->setPixmap(m_pSkinLoader->getSkinPreview(newSkin));
if (newSkin != m_skin) {
m_skin = newSkin;
m_bRebootMixxxView = newSkin != m_skinOnUpdate;
Expand Down
37 changes: 23 additions & 14 deletions src/preferences/dialog/dlgprefinterfacedlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>562</width>
<width>594</width>
<height>723</height>
</rect>
</property>
Expand Down Expand Up @@ -52,7 +52,7 @@
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<item row="2" column="1" colspan="2">
<widget class="QLabel" name="warningLabel">
<property name="text">
<string/>
Expand Down Expand Up @@ -81,7 +81,7 @@
</property>
</widget>
</item>
<item row="2" column="1" rowspan="2" colspan="2">
<item row="3" column="1" rowspan="2" colspan="2">
<widget class="QComboBox" name="ComboBoxSchemeconf">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
Expand All @@ -97,7 +97,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="textLabelLocale">
<property name="text">
<string>Locale</string>
Expand All @@ -107,14 +107,14 @@
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<item row="6" column="1" colspan="2">
<widget class="QComboBox" name="ComboBoxLocale">
<property name="toolTip">
<string>Locales determine country and language specific settings.</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="labelFullscreenOption">
<property name="text">
<string>Full-screen mode</string>
Expand All @@ -124,14 +124,14 @@
</property>
</widget>
</item>
<item row="7" column="1" colspan="2">
<item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="checkBoxStartFullScreen">
<property name="text">
<string>Start in full-screen mode</string>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="labelTooltips">
<property name="enabled">
<bool>true</bool>
Expand All @@ -150,7 +150,7 @@
</property>
</widget>
</item>
<item row="9" column="1" colspan="2">
<item row="10" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioButtonTooltipsOff">
Expand Down Expand Up @@ -184,7 +184,7 @@
</item>
</layout>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="labelScaleFactor">
<property name="text">
<string>HiDPI / Retina scaling</string>
Expand All @@ -194,7 +194,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="spinBoxScaleFactor">
<property name="toolTip">
<string>Change the size of text, buttons, and other items.</string>
Expand All @@ -216,7 +216,7 @@
</property>
</widget>
</item>
<item row="6" column="2">
<item row="7" column="2">
<widget class="QCheckBox" name="checkBoxScaleFactorAuto">
<property name="toolTip">
<string>Adopt scale factor from the operating system</string>
Expand All @@ -226,16 +226,23 @@
</property>
</widget>
</item>
<item row="10" column="0">
<item row="11" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Screen saver</string>
</property>
</widget>
</item>
<item row="10" column="1" colspan="2">
<item row="11" column="1" colspan="2">
<widget class="QComboBox" name="comboBoxScreensaver"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="skinPreviewLabel">
<property name="text">
<string notr="true">skin preview screenshot goes here</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -264,6 +271,8 @@
<tabstop>radioButtonTooltipsLibrary</tabstop>
<tabstop>radioButtonTooltipsLibraryAndSkin</tabstop>
</tabstops>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroupTooltips"/>
</buttongroups>
Expand Down
4 changes: 4 additions & 0 deletions src/skin/skinloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ QString SkinLoader::getSkinPath(const QString& skinName) const {
return QString();
}

QPixmap SkinLoader::getSkinPreview(const QString& skinName) const {
return QPixmap(getSkinPath(skinName) + "/preferences_preview_screenshot.png");
}

QString SkinLoader::getConfiguredSkinPath() const {
QString configSkin = m_pConfig->getValueString(ConfigKey("[Config]", "ResizableSkin"));

Expand Down
1 change: 1 addition & 0 deletions src/skin/skinloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class SkinLoader {
LaunchImage* loadLaunchImage(QWidget* pParent);

QString getSkinPath(const QString& skinName) const;
QPixmap getSkinPreview(const QString& skinName) const;
QString getConfiguredSkinPath() const;
QString getDefaultSkinName() const;
QList<QDir> getSkinSearchPaths() const;
Expand Down

0 comments on commit 80f9c8a

Please sign in to comment.