Skip to content

Commit

Permalink
customize qss
Browse files Browse the repository at this point in the history
  • Loading branch information
kaniol-lck committed Mar 2, 2022
1 parent 34ade7d commit 4c88ad2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/qss/dark.qss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ QTextBrowser, QScrollArea, QScrollArea .QWidget {
}

.Title {
color: black;
color: #fff;
font-weight: bold;
font-size: 13pt;
background: transparent;
Expand Down
18 changes: 14 additions & 4 deletions src/qss/stylesheets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const QString &styleSheetsPath()
{
static auto path = QDir(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation))
.absoluteFilePath("stylesheets");
QDir().mkpath(path);
return path;
}

Expand All @@ -25,7 +26,8 @@ const QMap<QString, QString> &builtinStyleSheets()
QMap<QString, QString> styleSheets()
{
auto styleSheets = builtinStyleSheets();
for(auto &&fileInfo : QDir(styleSheetsPath()).entryInfoList())
auto &&fileInfoList = QDir(styleSheetsPath()).entryInfoList();
for(auto &&fileInfo : fileInfoList)
if(fileInfo.suffix() == "qss"){
auto name = fileInfo.baseName();
if(!styleSheets.contains(name))
Expand All @@ -39,7 +41,15 @@ QString styleSheetPath(const QString &name)
if(!styleSheets().contains(name))
return QString("file:///:/stylesheet/%1.qss").arg("basic");
auto fileName = QDir(styleSheetsPath()).absoluteFilePath(name + ".qss");
if(!QFileInfo(fileName).exists() && builtinStyleSheets().contains(name))
return QString("file:///:/stylesheet/%1.qss").arg(name);
return fileName;
if(!QFileInfo::exists(fileName) && builtinStyleSheets().contains(name)){
QFile builtinFile(QString(":/stylesheet/%1.qss").arg(name));
QFile newFile(fileName);
if(builtinFile.open(QIODevice::ReadOnly) && newFile.open(QIODevice::WriteOnly)){
newFile.write("/* This file is auto generated from built-in stylesheet\n"
" * you can create you own qss based on this file.\n"
" */\n\n");
newFile.write(builtinFile.readAll());
}
}
return fileName.prepend("file:///");
}
25 changes: 8 additions & 17 deletions src/ui/local/batchrenamedialog.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>1080</width>
<width>726</width>
<height>720</height>
</rect>
</property>
Expand Down Expand Up @@ -46,9 +46,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Consolas ligaturized v2</family>
</font>
<font/>
</property>
<property name="text">
<string notr="true">&lt;filename&gt;</string>
Expand Down Expand Up @@ -89,9 +87,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<family>Consolas ligaturized v2</family>
</font>
<font/>
</property>
<property name="text">
<string notr="true">&lt;id&gt;</string>
Expand Down Expand Up @@ -132,9 +128,7 @@
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<family>Consolas ligaturized v2</family>
</font>
<font/>
</property>
<property name="text">
<string notr="true">&lt;name&gt;</string>
Expand Down Expand Up @@ -179,9 +173,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<family>Consolas ligaturized v2</family>
</font>
<font/>
</property>
<property name="text">
<string notr="true">&lt;version&gt;</string>
Expand Down Expand Up @@ -222,9 +214,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<property name="font">
<font>
<family>Consolas ligaturized v2</family>
</font>
<font/>
</property>
<property name="text">
<string notr="true">&lt;tags|...|...&gt;</string>
Expand Down Expand Up @@ -330,7 +320,8 @@
<item>
<widget class="QToolButton" name="historyButton">
<property name="icon">
<iconset theme="edit-undo-history"/>
<iconset theme="edit-undo-history">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
Expand Down

0 comments on commit 4c88ad2

Please sign in to comment.