Skip to content
Permalink
Browse files

Add link to user themes directory to LookConfig

  • Loading branch information...
hacst committed Sep 7, 2015
1 parent 3576e52 commit 426edb6fe73c5433ebbdb4a7eb218c33fed8d4f9
Showing with 32 additions and 8 deletions.
  1. +13 −6 src/mumble/LookConfig.cpp
  2. +11 −1 src/mumble/LookConfig.ui
  3. +5 −1 src/mumble/Themes.cpp
  4. +3 −0 src/mumble/Themes.h
@@ -81,6 +81,13 @@ LookConfig::LookConfig(Settings &st) : ConfigWidget(st) {
qcbChannelDrag->insertItem(Settings::Ask, tr("Ask"), Settings::Ask);
qcbChannelDrag->insertItem(Settings::DoNothing, tr("Do Nothing"), Settings::DoNothing);
qcbChannelDrag->insertItem(Settings::Move, tr("Move"), Settings::Move);

QDir userThemeDirectory = Themes::getUserThemesDirectory();
if (userThemeDirectory.exists()) {
QUrl userThemeDirectoryUrl = QUrl::fromLocalFile(userThemeDirectory.path());
qlThemesDirectory->setText(tr("<a href=\"%1\">Browse</a>").arg(userThemeDirectoryUrl.toString()));
qlThemesDirectory->setOpenExternalLinks(true);
}
}

QString LookConfig::title() const {
@@ -148,17 +155,17 @@ void LookConfig::load(const Settings &r) {
theme != themes.end();
++theme) {

for (ThemeInfo::StylesMap::const_iterator style = theme->styles.begin();
style != theme->styles.end();
++style) {
for (ThemeInfo::StylesMap::const_iterator styleit = theme->styles.begin();
styleit != theme->styles.end();
++styleit) {

if (configuredStyle
&& configuredStyle->themeName == style->themeName
&& configuredStyle->name == style->name) {
&& configuredStyle->themeName == styleit->themeName
&& configuredStyle->name == styleit->name) {
selectedThemeEntry = qcbTheme->count();
}

qcbTheme->addItem(theme->name + QLatin1String(" - ") + style->name, QVariant::fromValue(*style));
qcbTheme->addItem(theme->name + QLatin1String(" - ") + styleit->name, QVariant::fromValue(*styleit));
}
}

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>644</width>
<width>702</width>
<height>611</height>
</rect>
</property>
@@ -93,6 +93,16 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="qlThemesDirectory">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -124,6 +124,10 @@ ThemeMap Themes::getThemes() {
return ThemeInfo::scanDirectories(getSearchDirectories());
}

QDir Themes::getUserThemesDirectory() {
return QDir(g.qdBasePath.absolutePath() + QLatin1String("/Themes"));
}

QVector<QDir> Themes::getSearchDirectories() {
QVector<QDir> themeSearchDirectories;

@@ -132,7 +136,7 @@ QVector<QDir> Themes::getSearchDirectories() {
// Next come themes found in the applications Themes directory
themeSearchDirectories << QDir(MumbleApplication::instance()->applicationVersionRootPath() + QLatin1String("/Themes"));
// Highest priorty have themes located in the user directory
themeSearchDirectories << QDir(g.qdBasePath.absolutePath() + QLatin1String("/Themes"));
themeSearchDirectories << getUserThemesDirectory();

return themeSearchDirectories;
}
@@ -58,6 +58,9 @@ class Themes {
/// Return a theme name to theme map
static ThemeMap getThemes();

/// Returns the per user themes directory
static QDir getUserThemesDirectory();

private:
/// Applies the fallback stylesheet
static void applyFallback();

0 comments on commit 426edb6

Please sign in to comment.
You can’t perform that action at this time.