Add link to user themes directory to LookConfig

This commit is contained in:
Stefan Hacker 2015-09-08 01:00:10 +02:00
parent 3576e52981
commit 426edb6fe7
4 changed files with 32 additions and 8 deletions

View File

@ -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));
}
}

View File

@ -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>

View File

@ -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;
}

View File

@ -58,6 +58,9 @@ public:
/// 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();