| 133 | } |
| 134 | |
| 135 | void loadStyleSheets(QApplication& application) |
| 136 | { |
| 137 | QString stylesheet; |
| 138 | QString theme = DatabaseManager::getInstance().getConfigurationByName("Theme").getValue(); |
| 139 | |
| 140 | // Load default stylesheet.. |
| 141 | QFile defaultStylesheet(QString(":/Appearances/Stylesheets/%1/Default.css").arg(theme)); |
| 142 | if (defaultStylesheet.open(QFile::ReadOnly)) |
| 143 | { |
| 144 | QTextStream stream(&defaultStylesheet); |
| 145 | stylesheet = stream.readAll(); |
| 146 | defaultStylesheet.close(); |
| 147 | |
| 148 | application.setStyleSheet(stylesheet); |
| 149 | |
| 150 | defaultStylesheet.close(); |
| 151 | } |
| 152 | |
| 153 | // Load extended stylesheet. |
| 154 | QFile extendedStylesheet(QString(":/Appearances/Stylesheets/%1/Extended.css").arg(theme)); |
| 155 | if (extendedStylesheet.open(QFile::ReadOnly)) |
| 156 | { |
| 157 | QTextStream stream(&extendedStylesheet); |
| 158 | stylesheet += stream.readAll(); |
| 159 | extendedStylesheet.close(); |
| 160 | |
| 161 | application.setStyleSheet(stylesheet); |
| 162 | |
| 163 | extendedStylesheet.close(); |
| 164 | } |
| 165 | |
| 166 | // Load platform stylesheet. |
| 167 | #if defined(Q_OS_WIN) |
| 168 | QFile platformStylesheet(QString(":/Appearances/Stylesheets/%1/Windows.css").arg(theme)); |
| 169 | #elif defined(Q_OS_MAC) |
| 170 | QFile platformStylesheet(QString(":/Appearances/Stylesheets/%1/Mac.css").arg(theme)); |
| 171 | #elif defined(Q_OS_LINUX) |
| 172 | QFile platformStylesheet(QString(":/Appearances/Stylesheets/%1/Linux.css").arg(theme)); |
| 173 | #endif |
| 174 | if (platformStylesheet.open(QFile::ReadOnly)) |
| 175 | { |
| 176 | QTextStream stream(&platformStylesheet); |
| 177 | stylesheet += stream.readAll(); |
| 178 | platformStylesheet.close(); |
| 179 | |
| 180 | application.setStyleSheet(stylesheet); |
| 181 | |
| 182 | platformStylesheet.close(); |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | void loadFonts(QApplication& application) |
| 187 | { |
no test coverage detected