1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(themes): load css and images from themes folder

Original work by tox-user.

The default theme is now placed in a different path:
- C:\users\%username%\AppData\roaming\qtox\themes - for Windows
- ~/Library/Application Support/qtox/themes - for MacOS
- ~/.config/qtox/themes - for other Unix systems including GNU/Linux

Thanks to that it's no longer required to recompile the program to modify
the theme.

In addition to that the default theme is also included as a resource. If
the theme folder or some file inside it is missing, qTox will load it
from resource.
This commit is contained in:
Jimi Huotari 2018-09-10 14:19:22 +03:00 committed by sudden6
parent 10a4b249bb
commit 71d1fa6f24
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
96 changed files with 287 additions and 174 deletions

View File

@ -100,6 +100,15 @@ include_directories(${CMAKE_SOURCE_DIR})
include(Dependencies) include(Dependencies)
# Copy themes
if (UNIX AND NOT APPLE)
file(COPY ${CMAKE_SOURCE_DIR}/themes DESTINATION $ENV{HOME}/.config/qtox)
elseif (APPLE)
file(COPY ${CMAKE_SOURCE_DIR}/themes DESTINATION "$ENV{HOME}/Library/Application Support/qtox")
elseif (WIN32)
file(COPY ${CMAKE_SOURCE_DIR}/themes DESTINATION C:\\users\\%username%\\AppData\\roaming\\qtox)
endif()
################################################################################ ################################################################################
# #
# :: qTox main library sources # :: qTox main library sources

124
res.qrc
View File

@ -44,70 +44,70 @@
<file>img/taskbar/light/taskbar_offline.svg</file> <file>img/taskbar/light/taskbar_offline.svg</file>
<file>img/taskbar/light/taskbar_event.svg</file> <file>img/taskbar/light/taskbar_event.svg</file>
<file>img/transfer.svg</file> <file>img/transfer.svg</file>
<file>ui/fileTransferWidget/fileDone.svg</file> <file>themes/default/fileTransferWidget/fileDone.svg</file>
<file>ui/chatArea/chatArea.css</file> <file>themes/default/chatArea/chatArea.css</file>
<file>ui/chatArea/chatHead.css</file> <file>themes/default/chatArea/chatHead.css</file>
<file>ui/chatArea/innerStyle.css</file> <file>themes/default/chatArea/innerStyle.css</file>
<file>ui/chatArea/scrollBarUpArrow.svg</file> <file>themes/default/chatArea/scrollBarUpArrow.svg</file>
<file>ui/chatArea/scrollBarDownArrow.svg</file> <file>themes/default/chatArea/scrollBarDownArrow.svg</file>
<file>ui/chatArea/scrollBarLeftArrow.svg</file> <file>themes/default/chatArea/scrollBarLeftArrow.svg</file>
<file>ui/chatArea/scrollBarRightArrow.svg</file> <file>themes/default/chatArea/scrollBarRightArrow.svg</file>
<file>ui/chatForm/buttons.css</file> <file>themes/default/chatForm/buttons.css</file>
<file>ui/chatForm/fullScreenButtons.css</file> <file>themes/default/chatForm/fullScreenButtons.css</file>
<file>ui/chatForm/callButton.svg</file> <file>themes/default/chatForm/callButton.svg</file>
<file>ui/chatForm/labels.css</file> <file>themes/default/chatForm/labels.css</file>
<file>ui/chatForm/micButton.svg</file> <file>themes/default/chatForm/micButton.svg</file>
<file>ui/chatForm/micButtonRed.svg</file> <file>themes/default/chatForm/micButtonRed.svg</file>
<file>ui/chatForm/videoButton.svg</file> <file>themes/default/chatForm/videoButton.svg</file>
<file>ui/chatForm/videoButtonRed.svg</file> <file>themes/default/chatForm/videoButtonRed.svg</file>
<file>ui/chatForm/volButton.svg</file> <file>themes/default/chatForm/volButton.svg</file>
<file>ui/chatForm/volButtonRed.svg</file> <file>themes/default/chatForm/volButtonRed.svg</file>
<file>ui/chatForm/videoPreview.svg</file> <file>themes/default/chatForm/videoPreview.svg</file>
<file>ui/chatForm/videoPreviewRed.svg</file> <file>themes/default/chatForm/videoPreviewRed.svg</file>
<file>ui/chatForm/emoteButton.svg</file> <file>themes/default/chatForm/emoteButton.svg</file>
<file>ui/chatForm/fileButton.svg</file> <file>themes/default/chatForm/fileButton.svg</file>
<file>ui/chatForm/screenshotButton.svg</file> <file>themes/default/chatForm/screenshotButton.svg</file>
<file>ui/chatForm/searchCalendarButton.svg</file> <file>themes/default/chatForm/searchCalendarButton.svg</file>
<file>ui/chatForm/searchDownButton.svg</file> <file>themes/default/chatForm/searchDownButton.svg</file>
<file>ui/chatForm/searchHideButton.svg</file> <file>themes/default/chatForm/searchHideButton.svg</file>
<file>ui/chatForm/searchSettingsButton.svg</file> <file>themes/default/chatForm/searchSettingsButton.svg</file>
<file>ui/chatForm/searchUpButton.svg</file> <file>themes/default/chatForm/searchUpButton.svg</file>
<file>ui/chatForm/sendButton.svg</file> <file>themes/default/chatForm/sendButton.svg</file>
<file>ui/chatForm/exitFullScreenButton.svg</file> <file>themes/default/chatForm/exitFullScreenButton.svg</file>
<file>ui/emoticonWidget/dot_page.svg</file> <file>themes/default/emoticonWidget/dot_page.svg</file>
<file>ui/emoticonWidget/dot_page_current.svg</file> <file>themes/default/emoticonWidget/dot_page_current.svg</file>
<file>ui/emoticonWidget/dot_page_hover.svg</file> <file>themes/default/emoticonWidget/dot_page_hover.svg</file>
<file>ui/emoticonWidget/emoticonWidget.css</file> <file>themes/default/emoticonWidget/emoticonWidget.css</file>
<file>ui/fileTransferWidget/fileTransferWidget.css</file> <file>themes/default/fileTransferWidget/fileTransferWidget.css</file>
<file>ui/friendList/friendList.css</file> <file>themes/default/friendList/friendList.css</file>
<file>ui/msgEdit/msgEdit.css</file> <file>themes/default/msgEdit/msgEdit.css</file>
<file>ui/settings/mainContent.css</file> <file>themes/default/settings/mainContent.css</file>
<file>ui/settings/mainHead.css</file> <file>themes/default/settings/mainHead.css</file>
<file>ui/statusButton/statusButton.css</file> <file>themes/default/statusButton/statusButton.css</file>
<file>ui/statusButton/menu_indicator.svg</file> <file>themes/default/statusButton/menu_indicator.svg</file>
<file>ui/window/general.css</file> <file>themes/default/window/general.css</file>
<file>ui/window/profile.css</file> <file>themes/default/window/profile.css</file>
<file>ui/window/statusPanel.css</file> <file>themes/default/window/statusPanel.css</file>
<file>ui/window/window.css</file> <file>themes/default/window/window.css</file>
<file>ui/chatArea/info.svg</file> <file>themes/default/chatArea/info.svg</file>
<file>ui/chatArea/spinner.svg</file> <file>themes/default/chatArea/spinner.svg</file>
<file>ui/chatArea/typing.svg</file> <file>themes/default/chatArea/typing.svg</file>
<file>ui/chatArea/error.svg</file> <file>themes/default/chatArea/error.svg</file>
<file>ui/fileTransferInstance/no.svg</file> <file>themes/default/fileTransferInstance/no.svg</file>
<file>ui/fileTransferInstance/pause.svg</file> <file>themes/default/fileTransferInstance/pause.svg</file>
<file>ui/fileTransferInstance/yes.svg</file> <file>themes/default/fileTransferInstance/yes.svg</file>
<file>ui/fileTransferInstance/dir.svg</file> <file>themes/default/fileTransferInstance/dir.svg</file>
<file>ui/fileTransferInstance/arrow_white.svg</file> <file>themes/default/fileTransferInstance/arrow_white.svg</file>
<file>ui/fileTransferInstance/browse.svg</file> <file>themes/default/fileTransferInstance/browse.svg</file>
<file>ui/fileTransferInstance/filetransferWidget.css</file> <file>themes/default/fileTransferInstance/filetransferWidget.css</file>
<file>ui/acceptCall/acceptCall.svg</file> <file>themes/default/acceptCall/acceptCall.svg</file>
<file>ui/rejectCall/rejectCall.svg</file> <file>themes/default/rejectCall/rejectCall.svg</file>
<file>img/login_logo.svg</file> <file>img/login_logo.svg</file>
<file>ui/notificationEdge/notificationEdge.css</file> <file>themes/default/notificationEdge/notificationEdge.css</file>
<file>ui/loginScreen/loginScreen.css</file> <file>themes/default/loginScreen/loginScreen.css</file>
<file>img/others/logout-icon.svg</file> <file>img/others/logout-icon.svg</file>
<file>img/caps_lock.svg</file> <file>img/caps_lock.svg</file>
<file>ui/contentDialog/contentDialog.css</file> <file>themes/default/contentDialog/contentDialog.css</file>
<file>ui/tooliconsZone/tooliconsZone.css</file> <file>themes/default/tooliconsZone/tooliconsZone.css</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -26,6 +26,7 @@
#include "content/spinner.h" #include "content/spinner.h"
#include "content/text.h" #include "content/text.h"
#include "content/timestamp.h" #include "content/timestamp.h"
#include "src/widget/style.h"
#include <QDebug> #include <QDebug>
@ -92,7 +93,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString& sender, const QSt
? QString("%1 %2").arg(sender, rawMessage) ? QString("%1 %2").arg(sender, rawMessage)
: rawMessage), : rawMessage),
ColumnFormat(1.0, ColumnFormat::VariableSize)); ColumnFormat(1.0, ColumnFormat::VariableSize));
msg->addColumn(new Spinner(":/ui/chatArea/spinner.svg", QSize(16, 16), 360.0 / 1.6), msg->addColumn(new Spinner(Style::getImagePath("chatArea/spinner.svg"), QSize(16, 16), 360.0 / 1.6),
ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right)); ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
if (!date.isNull()) if (!date.isNull())
@ -110,13 +111,13 @@ ChatMessage::Ptr ChatMessage::createChatInfoMessage(const QString& rawMessage,
QString img; QString img;
switch (type) { switch (type) {
case INFO: case INFO:
img = ":/ui/chatArea/info.svg"; img = Style::getImagePath("chatArea/info.svg");
break; break;
case ERROR: case ERROR:
img = ":/ui/chatArea/error.svg"; img = Style::getImagePath("chatArea/error.svg");
break; break;
case TYPING: case TYPING:
img = ":/ui/chatArea/typing.svg"; img = Style::getImagePath("chatArea/typing.svg");
break; break;
} }

View File

@ -181,7 +181,7 @@ void FileTransferWidget::setBackgroundColor(const QColor& c, bool whiteFont)
setProperty("fontColor", whiteFont ? "white" : "black"); setProperty("fontColor", whiteFont ? "white" : "black");
setStyleSheet(Style::getStylesheet(":/ui/fileTransferInstance/filetransferWidget.css")); setStyleSheet(Style::getStylesheet("fileTransferInstance/filetransferWidget.css"));
Style::repolish(this); Style::repolish(this);
update(); update();
@ -387,12 +387,12 @@ void FileTransferWidget::onFileTransferFinished(ToxFile file)
setupButtons(); setupButtons();
hideWidgets(); hideWidgets();
ui->leftButton->setIcon(QIcon(":/ui/fileTransferInstance/yes.svg")); ui->leftButton->setIcon(QIcon(Style::getImagePath("fileTransferInstance/yes.svg")));
ui->leftButton->setObjectName("ok"); ui->leftButton->setObjectName("ok");
ui->leftButton->setToolTip(tr("Open file")); ui->leftButton->setToolTip(tr("Open file"));
ui->leftButton->show(); ui->leftButton->show();
ui->rightButton->setIcon(QIcon(":/ui/fileTransferInstance/dir.svg")); ui->rightButton->setIcon(QIcon(Style::getImagePath("fileTransferInstance/dir.svg")));
ui->rightButton->setObjectName("dir"); ui->rightButton->setObjectName("dir");
ui->rightButton->setToolTip(tr("Open file directory")); ui->rightButton->setToolTip(tr("Open file directory"));
ui->rightButton->show(); ui->rightButton->show();
@ -443,11 +443,11 @@ void FileTransferWidget::setupButtons()
{ {
switch (fileInfo.status) { switch (fileInfo.status) {
case ToxFile::TRANSMITTING: case ToxFile::TRANSMITTING:
ui->leftButton->setIcon(QIcon(":/ui/fileTransferInstance/pause.svg")); ui->leftButton->setIcon(QIcon(Style::getImagePath("fileTransferInstance/pause.svg")));
ui->leftButton->setObjectName("pause"); ui->leftButton->setObjectName("pause");
ui->leftButton->setToolTip(tr("Pause transfer")); ui->leftButton->setToolTip(tr("Pause transfer"));
ui->rightButton->setIcon(QIcon(":/ui/fileTransferInstance/no.svg")); ui->rightButton->setIcon(QIcon(Style::getImagePath("fileTransferInstance/no.svg")));
ui->rightButton->setObjectName("cancel"); ui->rightButton->setObjectName("cancel");
ui->rightButton->setToolTip(tr("Cancel transfer")); ui->rightButton->setToolTip(tr("Cancel transfer"));
@ -455,11 +455,11 @@ void FileTransferWidget::setupButtons()
break; break;
case ToxFile::PAUSED: case ToxFile::PAUSED:
ui->leftButton->setIcon(QIcon(":/ui/fileTransferInstance/arrow_white.svg")); ui->leftButton->setIcon(QIcon(Style::getImagePath("fileTransferInstance/arrow_white.svg")));
ui->leftButton->setObjectName("resume"); ui->leftButton->setObjectName("resume");
ui->leftButton->setToolTip(tr("Resume transfer")); ui->leftButton->setToolTip(tr("Resume transfer"));
ui->rightButton->setIcon(QIcon(":/ui/fileTransferInstance/no.svg")); ui->rightButton->setIcon(QIcon(Style::getImagePath("fileTransferInstance/no.svg")));
ui->rightButton->setObjectName("cancel"); ui->rightButton->setObjectName("cancel");
ui->rightButton->setToolTip(tr("Cancel transfer")); ui->rightButton->setToolTip(tr("Cancel transfer"));
@ -468,16 +468,16 @@ void FileTransferWidget::setupButtons()
case ToxFile::STOPPED: case ToxFile::STOPPED:
case ToxFile::BROKEN: case ToxFile::BROKEN:
ui->rightButton->setIcon(QIcon(":/ui/fileTransferInstance/no.svg")); ui->rightButton->setIcon(QIcon(Style::getImagePath("fileTransferInstance/no.svg")));
ui->rightButton->setObjectName("cancel"); ui->rightButton->setObjectName("cancel");
ui->rightButton->setToolTip(tr("Cancel transfer")); ui->rightButton->setToolTip(tr("Cancel transfer"));
if (fileInfo.direction == ToxFile::SENDING) { if (fileInfo.direction == ToxFile::SENDING) {
ui->leftButton->setIcon(QIcon(":/ui/fileTransferInstance/pause.svg")); ui->leftButton->setIcon(QIcon(Style::getImagePath("fileTransferInstance/pause.svg")));
ui->leftButton->setObjectName("pause"); ui->leftButton->setObjectName("pause");
ui->leftButton->setToolTip(tr("Pause transfer")); ui->leftButton->setToolTip(tr("Pause transfer"));
} else { } else {
ui->leftButton->setIcon(QIcon(":/ui/fileTransferInstance/yes.svg")); ui->leftButton->setIcon(QIcon(Style::getImagePath("fileTransferInstance/yes.svg")));
ui->leftButton->setObjectName("accept"); ui->leftButton->setObjectName("accept");
ui->leftButton->setToolTip(tr("Accept transfer")); ui->leftButton->setToolTip(tr("Accept transfer"));
} }

View File

@ -297,7 +297,7 @@
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../../res.qrc"> <iconset resource="../../../res.qrc">
<normaloff>:/ui/fileTransferInstance/no.svg</normaloff>:/ui/fileTransferInstance/no.svg</iconset> <normaloff>:themes/default/fileTransferInstance/no.svg</normaloff>:themes/default/fileTransferInstance/no.svg</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -383,7 +383,7 @@
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../../res.qrc"> <iconset resource="../../../res.qrc">
<normaloff>:/ui/fileTransferInstance/no.svg</normaloff>:/ui/fileTransferInstance/no.svg</iconset> <normaloff>:themes/default/fileTransferInstance/no.svg</normaloff>:themes/default/fileTransferInstance/no.svg</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -421,7 +421,7 @@
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../../res.qrc"> <iconset resource="../../../res.qrc">
<normaloff>:/ui/fileTransferInstance/no.svg</normaloff>:/ui/fileTransferInstance/no.svg</iconset> <normaloff>:themes/default/fileTransferInstance/no.svg</normaloff>:themes/default/fileTransferInstance/no.svg</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>

View File

@ -19,6 +19,7 @@
#include "notificationicon.h" #include "notificationicon.h"
#include "../pixmapcache.h" #include "../pixmapcache.h"
#include "src/widget/style.h"
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QPainter> #include <QPainter>
@ -27,7 +28,7 @@
NotificationIcon::NotificationIcon(QSize Size) NotificationIcon::NotificationIcon(QSize Size)
: size(Size) : size(Size)
{ {
pmap = PixmapCache::getInstance().get(":/ui/chatArea/typing.svg", size); pmap = PixmapCache::getInstance().get(Style::getImagePath("chatArea/typing.svg"), size);
updateTimer = new QTimer(this); updateTimer = new QTimer(this);
updateTimer->setInterval(1000 / 30); updateTimer->setInterval(1000 / 30);

View File

@ -40,7 +40,7 @@ Text::Text(const QString& txt, const QFont& font, bool enableElide, const QStrin
: rawText(rwText) : rawText(rwText)
, elide(enableElide) , elide(enableElide)
, defFont(font) , defFont(font)
, defStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatArea/innerStyle.css"), font)) , defStyleSheet(Style::getStylesheet(QStringLiteral("chatArea/innerStyle.css"), font))
, color(c) , color(c)
{ {
setText(txt); setText(txt);

View File

@ -32,7 +32,7 @@ const auto BTN_STATE_NONE = QVariant("none");
const auto BTN_STATE_RED = QVariant("red"); const auto BTN_STATE_RED = QVariant("red");
const int BTN_PANEL_HEIGHT = 55; const int BTN_PANEL_HEIGHT = 55;
const int BTN_PANEL_WIDTH = 250; const int BTN_PANEL_WIDTH = 250;
const auto BTN_STYLE_SHEET_PATH = QStringLiteral(":/ui/chatForm/fullScreenButtons.css"); const auto BTN_STYLE_SHEET_PATH = QStringLiteral("chatForm/fullScreenButtons.css");
} }
GenericNetCamView::GenericNetCamView(QWidget* parent) GenericNetCamView::GenericNetCamView(QWidget* parent)
@ -117,7 +117,7 @@ void GenericNetCamView::setShowMessages(bool show, bool notify)
toggleMessagesButton->setText(tr("Show Messages")); toggleMessagesButton->setText(tr("Show Messages"));
if (notify) { if (notify) {
toggleMessagesButton->setIcon(QIcon(":/ui/chatArea/info.svg")); toggleMessagesButton->setIcon(QIcon(Style::getImagePath("chatArea/info.svg")));
} }
} }

View File

@ -48,7 +48,7 @@ CategoryWidget::CategoryWidget(bool compact, QWidget* parent)
statusLabel->setObjectName("status"); statusLabel->setObjectName("status");
statusLabel->setTextFormat(Qt::PlainText); statusLabel->setTextFormat(Qt::PlainText);
statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg")); statusPic.setPixmap(QPixmap(Style::getImagePath("chatArea/scrollBarRightArrow.svg")));
fullLayout = new QVBoxLayout(this); fullLayout = new QVBoxLayout(this);
fullLayout->setSpacing(0); fullLayout->setSpacing(0);
@ -90,9 +90,9 @@ void CategoryWidget::setExpanded(bool isExpanded, bool save)
QString pixmapPath; QString pixmapPath;
if (isExpanded) if (isExpanded)
pixmapPath = ":/ui/chatArea/scrollBarDownArrow.svg"; pixmapPath = Style::getImagePath("chatArea/scrollBarDownArrow.svg");
else else
pixmapPath = ":/ui/chatArea/scrollBarRightArrow.svg"; pixmapPath = Style::getImagePath("chatArea/scrollBarRightArrow.svg");
statusPic.setPixmap(QPixmap(pixmapPath)); statusPic.setPixmap(QPixmap(pixmapPath));
// The listWidget will recieve a enterEvent for some reason if now visible. // The listWidget will recieve a enterEvent for some reason if now visible.
// Using the following, we prevent that. // Using the following, we prevent that.

View File

@ -38,7 +38,7 @@ static const short MIC_BUTTONS_LAYOUT_SPACING = 4;
static const short BUTTONS_LAYOUT_HOR_SPACING = 4; static const short BUTTONS_LAYOUT_HOR_SPACING = 4;
namespace { namespace {
const QString STYLE_PATH = QStringLiteral(":/ui/chatForm/buttons.css"); const QString STYLE_PATH = QStringLiteral("chatForm/buttons.css");
const QString STATE_NAME[] = { const QString STATE_NAME[] = {
QString{}, QString{},

View File

@ -63,7 +63,7 @@ ContentDialog::ContentDialog(QWidget* parent)
, videoCount(0) , videoCount(0)
{ {
const Settings& s = Settings::getInstance(); const Settings& s = Settings::getInstance();
setStyleSheet(Style::getStylesheet(":/ui/contentDialog/contentDialog.css")); setStyleSheet(Style::getStylesheet("contentDialog/contentDialog.css"));
friendLayout->setMargin(0); friendLayout->setMargin(0);
friendLayout->setSpacing(0); friendLayout->setSpacing(0);
@ -87,7 +87,7 @@ ContentDialog::ContentDialog(QWidget* parent)
friendScroll->setFrameStyle(QFrame::NoFrame); friendScroll->setFrameStyle(QFrame::NoFrame);
friendScroll->setLayoutDirection(Qt::RightToLeft); friendScroll->setLayoutDirection(Qt::RightToLeft);
friendScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); friendScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
friendScroll->setStyleSheet(Style::getStylesheet(":/ui/friendList/friendList.css")); friendScroll->setStyleSheet(Style::getStylesheet("friendList/friendList.css"));
friendScroll->setWidgetResizable(true); friendScroll->setWidgetResizable(true);
friendScroll->setWidget(friendWidget); friendScroll->setWidget(friendWidget);

View File

@ -111,8 +111,8 @@ void ContentLayout::init()
} }
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css")); mainHead->setStyleSheet(Style::getStylesheet("settings/mainHead.css"));
mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css")); mainContent->setStyleSheet(Style::getStylesheet("settings/mainContent.css"));
#endif #endif
mainHLineLayout.addWidget(&mainHLine); mainHLineLayout.addWidget(&mainHLine);

View File

@ -34,7 +34,7 @@
EmoticonsWidget::EmoticonsWidget(QWidget* parent) EmoticonsWidget::EmoticonsWidget(QWidget* parent)
: QMenu(parent) : QMenu(parent)
{ {
setStyleSheet(Style::getStylesheet(":/ui/emoticonWidget/emoticonWidget.css")); setStyleSheet(Style::getStylesheet("emoticonWidget/emoticonWidget.css"));
setLayout(&layout); setLayout(&layout);
layout.addWidget(&stack); layout.addWidget(&stack);

View File

@ -20,13 +20,14 @@
#include "filesform.h" #include "filesform.h"
#include "src/widget/contentlayout.h" #include "src/widget/contentlayout.h"
#include "src/widget/translator.h" #include "src/widget/translator.h"
#include "src/widget/style.h"
#include "src/widget/widget.h" #include "src/widget/widget.h"
#include <QFileInfo> #include <QFileInfo>
#include <QWindow> #include <QWindow>
FilesForm::FilesForm() FilesForm::FilesForm()
: QObject() : QObject()
, doneIcon(":/ui/fileTransferWidget/fileDone.svg") , doneIcon(Style::getImagePath("fileTransferWidget/fileDone.svg"))
{ {
head = new QWidget(); head = new QWidget();
QFont bold; QFont bold;

View File

@ -58,7 +58,7 @@
* elements and methods to work with chat messages. * elements and methods to work with chat messages.
*/ */
#define SET_STYLESHEET(x) (x)->setStyleSheet(Style::getStylesheet(":/ui/" #x "/" #x ".css")) #define SET_STYLESHEET(x) (x)->setStyleSheet(Style::getStylesheet(":/themes/default/" #x "/" #x ".css"))
static const QSize FILE_FLYOUT_SIZE{24, 24}; static const QSize FILE_FLYOUT_SIZE{24, 24};
static const short FOOT_BUTTONS_SPACING = 2; static const short FOOT_BUTTONS_SPACING = 2;
@ -108,7 +108,7 @@ QString GenericChatForm::resolveToxPk(const ToxPk& pk)
namespace namespace
{ {
const QString STYLE_PATH = QStringLiteral(":/ui/chatForm/buttons.css"); const QString STYLE_PATH = QStringLiteral("chatForm/buttons.css");
} }
namespace namespace
@ -170,7 +170,7 @@ GenericChatForm::GenericChatForm(const Contact* contact, QWidget* parent)
fileLayout->setSpacing(0); fileLayout->setSpacing(0);
fileLayout->setMargin(0); fileLayout->setMargin(0);
msgEdit->setStyleSheet(Style::getStylesheet(":/ui/msgEdit/msgEdit.css") msgEdit->setStyleSheet(Style::getStylesheet("msgEdit/msgEdit.css")
+ fontToCss(s.getChatMessageFont(), "QTextEdit")); + fontToCss(s.getChatMessageFont(), "QTextEdit"));
msgEdit->setFixedHeight(MESSAGE_EDIT_HEIGHT); msgEdit->setFixedHeight(MESSAGE_EDIT_HEIGHT);
msgEdit->setFrameStyle(QFrame::NoFrame); msgEdit->setFrameStyle(QFrame::NoFrame);
@ -238,8 +238,8 @@ GenericChatForm::GenericChatForm(const Contact* contact, QWidget* parent)
connect(chatWidget, &ChatLog::workerTimeoutFinished, this, &GenericChatForm::onContinueSearch); connect(chatWidget, &ChatLog::workerTimeoutFinished, this, &GenericChatForm::onContinueSearch);
chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css")); chatWidget->setStyleSheet(Style::getStylesheet("chatArea/chatArea.css"));
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css")); headWidget->setStyleSheet(Style::getStylesheet("chatArea/chatHead.css"));
fileFlyout->setFixedSize(FILE_FLYOUT_SIZE); fileFlyout->setFixedSize(FILE_FLYOUT_SIZE);
fileFlyout->setParent(this); fileFlyout->setParent(this);
@ -523,7 +523,7 @@ void GenericChatForm::onChatMessageFontChanged(const QFont& font)
chatWidget->fontChanged(font); chatWidget->fontChanged(font);
chatWidget->forceRelayout(); chatWidget->forceRelayout();
// message editor // message editor
msgEdit->setStyleSheet(Style::getStylesheet(":/ui/msgEdit/msgEdit.css") msgEdit->setStyleSheet(Style::getStylesheet("msgEdit/msgEdit.css")
+ fontToCss(font, "QTextEdit")); + fontToCss(font, "QTextEdit"));
} }

View File

@ -50,7 +50,7 @@ const auto LABEL_PEER_TYPE_OUR = QVariant(QStringLiteral("our"));
const auto LABEL_PEER_TYPE_MUTED = QVariant(QStringLiteral("muted")); const auto LABEL_PEER_TYPE_MUTED = QVariant(QStringLiteral("muted"));
const auto LABEL_PEER_PLAYING_AUDIO = QVariant(QStringLiteral("true")); const auto LABEL_PEER_PLAYING_AUDIO = QVariant(QStringLiteral("true"));
const auto LABEL_PEER_NOT_PLAYING_AUDIO = QVariant(QStringLiteral("false")); const auto LABEL_PEER_NOT_PLAYING_AUDIO = QVariant(QStringLiteral("false"));
const auto PEER_LABEL_STYLE_SHEET_PATH = QStringLiteral(":/ui/chatArea/chatHead.css"); const auto PEER_LABEL_STYLE_SHEET_PATH = QStringLiteral("chatArea/chatHead.css");
} }
/** /**

View File

@ -144,7 +144,7 @@ ProfileForm::ProfileForm(IProfileInfo* profileInfo, QWidget* parent)
profilePicture->installEventFilter(this); profilePicture->installEventFilter(this);
profilePicture->setAccessibleName("Profile avatar"); profilePicture->setAccessibleName("Profile avatar");
profilePicture->setAccessibleDescription("Set a profile avatar shown to all contacts"); profilePicture->setAccessibleDescription("Set a profile avatar shown to all contacts");
profilePicture->setStyleSheet(Style::getStylesheet(":ui/window/profile.css")); profilePicture->setStyleSheet(Style::getStylesheet("window/profile.css"));
connect(profilePicture, &MaskablePixmapWidget::clicked, this, &ProfileForm::onAvatarClicked); connect(profilePicture, &MaskablePixmapWidget::clicked, this, &ProfileForm::onAvatarClicked);
connect(profilePicture, &MaskablePixmapWidget::customContextMenuRequested, connect(profilePicture, &MaskablePixmapWidget::customContextMenuRequested,
this, &ProfileForm::showProfilePictureContextMenu); this, &ProfileForm::showProfilePictureContextMenu);

View File

@ -15,9 +15,9 @@ SearchSettingsForm::SearchSettingsForm(QWidget *parent) :
ui->choiceDateButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); ui->choiceDateButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
ui->choiceDateButton->setObjectName(QStringLiteral("choiceDateButton")); ui->choiceDateButton->setObjectName(QStringLiteral("choiceDateButton"));
ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css"))); ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
ui->startDateLabel->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/labels.css"))); ui->startDateLabel->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/labels.css")));
connect(ui->startSearchComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(ui->startSearchComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &SearchSettingsForm::onStartSearchSelected); this, &SearchSettingsForm::onStartSearchSelected);
@ -93,7 +93,7 @@ void SearchSettingsForm::onStartSearchSelected(const int index)
ui->startDateLabel->setEnabled(true); ui->startDateLabel->setEnabled(true);
ui->choiceDateButton->setProperty("state", QStringLiteral("green")); ui->choiceDateButton->setProperty("state", QStringLiteral("green"));
ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css"))); ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
if (startDate.isNull()) { if (startDate.isNull()) {
startDate = QDate::currentDate(); startDate = QDate::currentDate();
@ -105,7 +105,7 @@ void SearchSettingsForm::onStartSearchSelected(const int index)
ui->startDateLabel->setEnabled(false); ui->startDateLabel->setEnabled(false);
ui->choiceDateButton->setProperty("state", QString()); ui->choiceDateButton->setProperty("state", QString());
ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css"))); ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
} }
setUpdate(true); setUpdate(true);

View File

@ -60,7 +60,7 @@ LoginScreen::LoginScreen(QString initialProfile, QWidget* parent)
connect(ui->importButton, &QPushButton::clicked, this, &LoginScreen::onImportProfile); connect(ui->importButton, &QPushButton::clicked, this, &LoginScreen::onImportProfile);
reset(initialProfile); reset(initialProfile);
this->setStyleSheet(Style::getStylesheet(":/ui/loginScreen/loginScreen.css")); this->setStyleSheet(Style::getStylesheet("loginScreen/loginScreen.css"));
retranslateUi(); retranslateUi();
Translator::registerHandler(std::bind(&LoginScreen::retranslateUi, this), this); Translator::registerHandler(std::bind(&LoginScreen::retranslateUi, this), this);

View File

@ -28,7 +28,7 @@ NotificationEdgeWidget::NotificationEdgeWidget(Position position, QWidget* paren
: QWidget(parent) : QWidget(parent)
{ {
setAttribute(Qt::WA_StyledBackground); // Show background. setAttribute(Qt::WA_StyledBackground); // Show background.
setStyleSheet(Style::getStylesheet(":/ui/notificationEdge/notificationEdge.css")); setStyleSheet(Style::getStylesheet("notificationEdge/notificationEdge.css"));
QHBoxLayout* layout = new QHBoxLayout(this); QHBoxLayout* layout = new QHBoxLayout(this);
layout->addStretch(); layout->addStretch();
@ -39,9 +39,9 @@ NotificationEdgeWidget::NotificationEdgeWidget(Position position, QWidget* paren
QLabel* arrowLabel = new QLabel(this); QLabel* arrowLabel = new QLabel(this);
if (position == Top) if (position == Top)
arrowLabel->setPixmap(QPixmap("://ui/chatArea/scrollBarUpArrow.svg")); arrowLabel->setPixmap(QPixmap(Style::getImagePath("chatArea/scrollBarUpArrow.svg")));
else else
arrowLabel->setPixmap(QPixmap("://ui/chatArea/scrollBarDownArrow.svg")); arrowLabel->setPixmap(QPixmap(Style::getImagePath("chatArea/scrollBarDownArrow.svg")));
layout->addWidget(arrowLabel); layout->addWidget(arrowLabel);
layout->addStretch(); layout->addStretch();

View File

@ -48,7 +48,7 @@ SearchForm::SearchForm(QWidget* parent) : QWidget(parent)
settings->setVisible(false); settings->setVisible(false);
messageLabel->setProperty("state", QStringLiteral("red")); messageLabel->setProperty("state", QStringLiteral("red"));
messageLabel->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/labels.css"))); messageLabel->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/labels.css")));
messageLabel->setText(tr("The text could not be found.")); messageLabel->setText(tr("The text could not be found."));
messageLabel->setVisible(false); messageLabel->setVisible(false);
@ -130,7 +130,7 @@ QPushButton *SearchForm::createButton(const QString& name, const QString& state)
btn->setAttribute(Qt::WA_LayoutUsesWidgetRect); btn->setAttribute(Qt::WA_LayoutUsesWidgetRect);
btn->setObjectName(name); btn->setObjectName(name);
btn->setProperty("state", state); btn->setProperty("state", state);
btn->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css"))); btn->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
return btn; return btn;
} }
@ -156,7 +156,7 @@ void SearchForm::setStateName(QPushButton *btn, ToolButtonState state)
{ {
const auto index = static_cast<unsigned long>(state); const auto index = static_cast<unsigned long>(state);
btn->setProperty("state", STATE_NAME[index]); btn->setProperty("state", STATE_NAME[index]);
btn->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css"))); btn->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
btn->setEnabled(index != 0); btn->setEnabled(index != 0);
} }

View File

@ -22,11 +22,13 @@
#include "src/widget/gui.h" #include "src/widget/gui.h"
#include <QDebug> #include <QDebug>
#include <QDir>
#include <QFile> #include <QFile>
#include <QFontInfo> #include <QFontInfo>
#include <QMap> #include <QMap>
#include <QPainter> #include <QPainter>
#include <QRegularExpression> #include <QRegularExpression>
#include <QStringBuilder>
#include <QStyle> #include <QStyle>
#include <QSvgRenderer> #include <QSvgRenderer>
#include <QWidget> #include <QWidget>
@ -89,6 +91,31 @@ QStringList Style::getThemeColorNames()
QObject::tr("Violet")}; QObject::tr("Violet")};
} }
QString Style::getThemeName()
{
//TODO: return name of the current theme
const QString themeName = "default";
return QStringLiteral("default");
}
QString Style::getThemePath()
{
const QString themeName = getThemeName();
const QString homePath = QDir::homePath();
#if defined(Q_OS_UNIX) and not defined(Q_OS_MACOS)
const QString themePath = homePath % QLatin1String("/.config/qtox/themes/") % themeName % '/';
#elif defined(Q_OS_MACOS)
const QString themePath = homePath % QLatin1String("/Library/Application Support/qtox/themes/")
% themeName % '/';
#elif defined(Q_OS_WIN32)
const QString themePath = homePath % QLatin1String("/AppData/roaming/qtox/themes/")
% themeName % '/';
#endif
return themePath;
}
QList<QColor> Style::themeColorColors = {QColor(), QColor("#004aa4"), QColor("#97ba00"), QList<QColor> Style::themeColorColors = {QColor(), QColor("#004aa4"), QColor("#97ba00"),
QColor("#c23716"), QColor("#4617b5")}; QColor("#c23716"), QColor("#4617b5")};
@ -98,7 +125,8 @@ std::map<std::pair<const QString, const QFont>, const QString> Style::stylesheet
const QString Style::getStylesheet(const QString& filename, const QFont& baseFont) const QString Style::getStylesheet(const QString& filename, const QFont& baseFont)
{ {
const std::pair<const QString, const QFont> cacheKey(filename, baseFont); const QString fullPath = getThemePath() + filename;
const std::pair<const QString, const QFont> cacheKey(fullPath, baseFont);
auto it = stylesheetsCache.find(cacheKey); auto it = stylesheetsCache.find(cacheKey);
if (it != stylesheetsCache.end()) if (it != stylesheetsCache.end())
{ {
@ -111,6 +139,34 @@ const QString Style::getStylesheet(const QString& filename, const QFont& baseFon
return newStylesheet; return newStylesheet;
} }
static QStringList existingImagesCache;
const QString Style::getImagePath(const QString& filename)
{
QString fullPath = getThemePath() + filename;
// search for image in cache
if (existingImagesCache.contains(fullPath)) {
return fullPath;
}
// if not in cache
if (QFileInfo::exists(fullPath)) {
existingImagesCache << fullPath;
return fullPath;
} else {
qWarning() << "Failed to open file (using defaults):" << fullPath;
fullPath = QLatin1String(":themes/default/") % filename;
if (QFileInfo::exists(fullPath)) {
return fullPath;
} else {
qWarning() << "Failed to open default file:" << fullPath;
return {};
}
}
}
QColor Style::getColor(Style::ColorPalette entry) QColor Style::getColor(Style::ColorPalette entry)
{ {
return palette[entry]; return palette[entry];
@ -138,12 +194,26 @@ QFont Style::getFont(Style::Font font)
const QString Style::resolve(const QString& filename, const QFont& baseFont) const QString Style::resolve(const QString& filename, const QFont& baseFont)
{ {
QFile file{filename}; QString themePath = getThemePath();
if (!file.open(QFile::ReadOnly | QFile::Text)) { QString fullPath = themePath + filename;
qWarning() << "Stylesheet " << filename << " not found"; QString qss;
return QString("");
QFile file{fullPath};
if (file.open(QFile::ReadOnly | QFile::Text)) {
qss = file.readAll();
} else {
qWarning() << "Failed to open file (using defaults):" << fullPath;
fullPath = QLatin1String(":themes/default/") % filename;
QFile file{fullPath};
if (file.open(QFile::ReadOnly | QFile::Text)) {
qss = file.readAll();
} else {
qWarning() << "Failed to open default file:" << fullPath;
return {};
}
} }
QString qss = file.readAll();
if (dict.isEmpty()) { if (dict.isEmpty()) {
dict = {// colors dict = {// colors
@ -175,8 +245,35 @@ const QString Style::resolve(const QString& filename, const QFont& baseFont)
} }
for (const QString& key : dict.keys()) { for (const QString& key : dict.keys()) {
qss.replace(QRegularExpression(QString("%1\\b").arg(key)), dict[key]); qss.replace(QRegularExpression(key % QLatin1Literal{"\\b"}), dict[key]);
} }
// @getImagePath() function
const QRegularExpression re{QStringLiteral(R"(@getImagePath\([^)\s]*\))")};
QRegularExpressionMatchIterator i = re.globalMatch(qss);
while (i.hasNext()) {
QRegularExpressionMatch match = i.next();
QString path = match.captured(0);
const QString phrase = path;
path.remove(QStringLiteral("@getImagePath("));
path.chop(1);
QString fullImagePath = getThemePath() + path;
// image not in cache
if (!existingImagesCache.contains(fullPath)) {
if (QFileInfo::exists(fullImagePath)) {
existingImagesCache << fullImagePath;
} else {
qWarning() << "Failed to open file (using defaults):" << fullImagePath;
fullImagePath = QLatin1String(":themes/default/") % path;
}
}
qss.replace(phrase, fullImagePath);
}
return qss; return qss;
} }

View File

@ -60,6 +60,9 @@ public:
static QStringList getThemeColorNames(); static QStringList getThemeColorNames();
static const QString getStylesheet(const QString& filename, const QFont& baseFont = QFont()); static const QString getStylesheet(const QString& filename, const QFont& baseFont = QFont());
static const QString getImagePath(const QString& filename);
static QString getThemePath();
static QString getThemeName();
static QColor getColor(ColorPalette entry); static QColor getColor(ColorPalette entry);
static QFont getFont(Font font); static QFont getFont(Font font);
static const QString resolve(const QString& filename, const QFont& baseFont = QFont()); static const QString resolve(const QString& filename, const QFont& baseFont = QFont());

View File

@ -19,6 +19,7 @@
#include "callconfirmwidget.h" #include "callconfirmwidget.h"
#include "src/widget/style.h"
#include "src/widget/widget.h" #include "src/widget/widget.h"
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QHBoxLayout> #include <QHBoxLayout>
@ -89,8 +90,8 @@ CallConfirmWidget::CallConfirmWidget(const QWidget* anchor)
reject->setFlat(true); reject->setFlat(true);
accept->setStyleSheet("QPushButton{border:none;}"); accept->setStyleSheet("QPushButton{border:none;}");
reject->setStyleSheet("QPushButton{border:none;}"); reject->setStyleSheet("QPushButton{border:none;}");
accept->setIcon(QIcon(":/ui/acceptCall/acceptCall.svg")); accept->setIcon(QIcon(Style::getImagePath("acceptCall/acceptCall.svg")));
reject->setIcon(QIcon(":/ui/rejectCall/rejectCall.svg")); reject->setIcon(QIcon(Style::getImagePath("rejectCall/rejectCall.svg")));
accept->setIconSize(accept->size()); accept->setIconSize(accept->size());
reject->setIconSize(reject->size()); reject->setIconSize(reject->size());

View File

@ -142,17 +142,17 @@ void Widget::init()
actionQuit->setMenuRole(QAction::QuitRole); actionQuit->setMenuRole(QAction::QuitRole);
#endif #endif
actionQuit->setIcon(prepareIcon(":/ui/rejectCall/rejectCall.svg", icon_size, icon_size)); actionQuit->setIcon(prepareIcon(Style::getImagePath("rejectCall/rejectCall.svg"), icon_size, icon_size));
connect(actionQuit, &QAction::triggered, qApp, &QApplication::quit); connect(actionQuit, &QAction::triggered, qApp, &QApplication::quit);
layout()->setContentsMargins(0, 0, 0, 0); layout()->setContentsMargins(0, 0, 0, 0);
ui->friendList->setStyleSheet(Style::getStylesheet(":/ui/friendList/friendList.css")); ui->friendList->setStyleSheet(Style::getStylesheet("friendList/friendList.css"));
profilePicture = new MaskablePixmapWidget(this, QSize(40, 40), ":/img/avatar_mask.svg"); profilePicture = new MaskablePixmapWidget(this, QSize(40, 40), ":/img/avatar_mask.svg");
profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg")); profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg"));
profilePicture->setClickable(true); profilePicture->setClickable(true);
profilePicture->setObjectName("selfAvatar"); profilePicture->setObjectName("selfAvatar");
profilePicture->setStyleSheet(Style::getStylesheet(":ui/window/profile.css")); profilePicture->setStyleSheet(Style::getStylesheet("window/profile.css"));
ui->myProfile->insertWidget(0, profilePicture); ui->myProfile->insertWidget(0, profilePicture);
ui->myProfile->insertSpacing(1, 7); ui->myProfile->insertSpacing(1, 7);
@ -196,7 +196,7 @@ void Widget::init()
ui->searchContactFilterBox->setMenu(filterMenu); ui->searchContactFilterBox->setMenu(filterMenu);
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css")); ui->statusHead->setStyleSheet(Style::getStylesheet("window/statusPanel.css"));
#endif #endif
contactListWidget = new FriendListWidget(this, Settings::getInstance().getGroupchatPosition()); contactListWidget = new FriendListWidget(this, Settings::getInstance().getGroupchatPosition());
@ -206,7 +206,7 @@ void Widget::init()
ui->statusLabel->setEditable(true); ui->statusLabel->setEditable(true);
ui->statusPanel->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css")); ui->statusPanel->setStyleSheet(Style::getStylesheet("window/statusPanel.css"));
QMenu* statusButtonMenu = new QMenu(ui->statusButton); QMenu* statusButtonMenu = new QMenu(ui->statusButton);
statusButtonMenu->addAction(statusOnline); statusButtonMenu->addAction(statusOnline);
@ -2217,13 +2217,13 @@ void Widget::clearAllReceipts()
void Widget::reloadTheme() void Widget::reloadTheme()
{ {
this->setStyleSheet(Style::getStylesheet(":/ui/window/general.css")); this->setStyleSheet(Style::getStylesheet("window/general.css"));
QString statusPanelStyle = Style::getStylesheet(":/ui/window/statusPanel.css"); QString statusPanelStyle = Style::getStylesheet("window/statusPanel.css");
ui->tooliconsZone->setStyleSheet(Style::getStylesheet(":/ui/tooliconsZone/tooliconsZone.css")); ui->tooliconsZone->setStyleSheet(Style::getStylesheet("tooliconsZone/tooliconsZone.css"));
ui->statusPanel->setStyleSheet(statusPanelStyle); ui->statusPanel->setStyleSheet(statusPanelStyle);
ui->statusHead->setStyleSheet(statusPanelStyle); ui->statusHead->setStyleSheet(statusPanelStyle);
ui->friendList->setStyleSheet(Style::getStylesheet(":/ui/friendList/friendList.css")); ui->friendList->setStyleSheet(Style::getStylesheet("friendList/friendList.css"));
ui->statusButton->setStyleSheet(Style::getStylesheet(":/ui/statusButton/statusButton.css")); ui->statusButton->setStyleSheet(Style::getStylesheet("statusButton/statusButton.css"));
contactListWidget->reDraw(); contactListWidget->reDraw();
for (Friend* f : FriendList::getAllFriends()) { for (Friend* f : FriendList::getAllFriends()) {

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 894 B

After

Width:  |  Height:  |  Size: 894 B

View File

Before

Width:  |  Height:  |  Size: 904 B

After

Width:  |  Height:  |  Size: 904 B

View File

Before

Width:  |  Height:  |  Size: 902 B

After

Width:  |  Height:  |  Size: 902 B

View File

Before

Width:  |  Height:  |  Size: 897 B

After

Width:  |  Height:  |  Size: 897 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -2,7 +2,7 @@
QAbstractButton#emoteButton QAbstractButton#emoteButton
{ {
background-image: url(":/ui/chatForm/emoteButton.svg"); background-image: url("@getImagePath(chatForm/emoteButton.svg)");
border-top-right-radius: 5px; border-top-right-radius: 5px;
width: 24px; width: 24px;
height: 24px; height: 24px;
@ -10,7 +10,7 @@ QAbstractButton#emoteButton
QAbstractButton#fileButton QAbstractButton#fileButton
{ {
background-image: url(":/ui/chatForm/fileButton.svg"); background-image: url("@getImagePath(chatForm/fileButton.svg)");
border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;
width: 24px; width: 24px;
height: 24px; height: 24px;
@ -18,7 +18,7 @@ QAbstractButton#fileButton
QAbstractButton#screenshotButton QAbstractButton#screenshotButton
{ {
background-image: url(":/ui/chatForm/screenshotButton.svg"); background-image: url("@getImagePath(chatForm/screenshotButton.svg)");
border-top-left-radius: 5px; border-top-left-radius: 5px;
width: 24px; width: 24px;
height: 24px; height: 24px;
@ -26,7 +26,7 @@ QAbstractButton#screenshotButton
QAbstractButton#sendButton QAbstractButton#sendButton
{ {
background-image: url(":/ui/chatForm/sendButton.svg"); background-image: url("@getImagePath(chatForm/sendButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 50px; width: 50px;
height: 50px; height: 50px;
@ -37,7 +37,7 @@ QAbstractButton#sendButton
QAbstractButton#volButton QAbstractButton#volButton
{ {
border-image: url(":/ui/chatForm/volButton.svg"); border-image: url("@getImagePath(chatForm/volButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 22px; width: 22px;
height: 18px; height: 18px;
@ -45,7 +45,7 @@ QAbstractButton#volButton
QAbstractButton#micButton QAbstractButton#micButton
{ {
border-image: url(":/ui/chatForm/micButton.svg"); border-image: url("@getImagePath(chatForm/micButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 22px; width: 22px;
height: 18px; height: 18px;
@ -53,7 +53,7 @@ QAbstractButton#micButton
QAbstractButton#videoButton QAbstractButton#videoButton
{ {
background-image: url(":/ui/chatForm/videoButton.svg"); background-image: url("@getImagePath(chatForm/videoButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 50px; width: 50px;
height: 40px; height: 40px;
@ -61,7 +61,7 @@ QAbstractButton#videoButton
QAbstractButton#callButton QAbstractButton#callButton
{ {
background-image: url(":/ui/chatForm/callButton.svg"); background-image: url("@getImagePath(chatForm/callButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 50px; width: 50px;
height: 40px; height: 40px;
@ -71,7 +71,7 @@ QAbstractButton#callButton
QAbstractButton#searchSettingsButton QAbstractButton#searchSettingsButton
{ {
background-image: url(":/ui/chatForm/searchSettingsButton.svg"); background-image: url("@getImagePath(chatForm/searchSettingsButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 35px; width: 35px;
height: 35px; height: 35px;
@ -79,7 +79,7 @@ QAbstractButton#searchSettingsButton
QAbstractButton#searchHideButton QAbstractButton#searchHideButton
{ {
background-image: url(":/ui/chatForm/searchHideButton.svg"); background-image: url("@getImagePath(chatForm/searchHideButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 35px; width: 35px;
height: 35px; height: 35px;
@ -87,7 +87,7 @@ QAbstractButton#searchHideButton
QAbstractButton#searchUpButton QAbstractButton#searchUpButton
{ {
background-image: url(":/ui/chatForm/searchUpButton.svg"); background-image: url("@getImagePath(chatForm/searchUpButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 35px; width: 35px;
height: 35px; height: 35px;
@ -95,7 +95,7 @@ QAbstractButton#searchUpButton
QAbstractButton#searchDownButton QAbstractButton#searchDownButton
{ {
background-image: url(":/ui/chatForm/searchDownButton.svg"); background-image: url("@getImagePath(chatForm/searchDownButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 35px; width: 35px;
height: 35px; height: 35px;
@ -103,7 +103,7 @@ QAbstractButton#searchDownButton
QAbstractButton#choiceDateButton QAbstractButton#choiceDateButton
{ {
background-image: url(":/ui/chatForm/searchCalendarButton.svg"); background-image: url("@getImagePath(chatForm/searchCalendarButton.svg)");
border-radius: 5px; border-radius: 5px;
width: 45px; width: 45px;
height: 35px; height: 35px;

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -25,7 +25,7 @@ QAbstractButton:pressed
QAbstractButton#volButtonFullScreen QAbstractButton#volButtonFullScreen
{ {
background-image: url(":/ui/chatForm/volButton.svg"); background-image: url("@getImagePath(chatForm/volButton.svg)");
width: 11px; width: 11px;
height: 9px; height: 9px;
padding: 12px; padding: 12px;
@ -33,7 +33,7 @@ QAbstractButton#volButtonFullScreen
QAbstractButton#micButtonFullScreen QAbstractButton#micButtonFullScreen
{ {
background-image: url(":/ui/chatForm/micButton.svg"); background-image: url("@getImagePath(chatForm/micButton.svg)");
width: 11px; width: 11px;
height: 9px; height: 9px;
padding: 12px; padding: 12px;
@ -41,14 +41,14 @@ QAbstractButton#micButtonFullScreen
QAbstractButton#videoButtonFullScreen QAbstractButton#videoButtonFullScreen
{ {
background-image: url(":/ui/chatForm/videoButtonRed.svg"); background-image: url("@getImagePath(chatForm/videoButtonRed.svg)");
width: 37px; width: 37px;
height: 33px; height: 33px;
} }
QAbstractButton#videoPreviewButton QAbstractButton#videoPreviewButton
{ {
background-image: url(":/ui/chatForm/videoPreview.svg"); background-image: url("@getImagePath(chatForm/videoPreview.svg)");
width: 13px; width: 13px;
height: 13px; height: 13px;
padding: 10px; padding: 10px;
@ -56,7 +56,7 @@ QAbstractButton#videoPreviewButton
QAbstractButton#exitFullScreenButton QAbstractButton#exitFullScreenButton
{ {
background-image: url(":/ui/chatForm/exitFullScreenButton.svg"); background-image: url("@getImagePath(chatForm/exitFullScreenButton.svg)");
width: 30px; width: 30px;
height: 30px; height: 30px;
padding: 1px; padding: 1px;
@ -64,15 +64,15 @@ QAbstractButton#exitFullScreenButton
QAbstractButton#volButtonFullScreen[state="red"] QAbstractButton#volButtonFullScreen[state="red"]
{ {
background-image: url(":/ui/chatForm/volButtonRed.svg"); background-image: url("@getImagePath(chatForm/volButtonRed.svg)");
} }
QAbstractButton#micButtonFullScreen[state="red"] QAbstractButton#micButtonFullScreen[state="red"]
{ {
background-image: url(":/ui/chatForm/micButtonRed.svg"); background-image: url("@getImagePath(chatForm/micButtonRed.svg)");
} }
QAbstractButton#videoPreviewButton[state="red"] QAbstractButton#videoPreviewButton[state="red"]
{ {
background-image: url(":/ui/chatForm/videoPreviewRed.svg"); background-image: url("@getImagePath(chatForm/videoPreviewRed.svg)");
} }

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 482 B

After

Width:  |  Height:  |  Size: 482 B

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,7 +1,7 @@
QPushButton QPushButton
{ {
background-color: #6bc260; background-color: #6bc260;
background-image: url(":/ui/emoteButton/emoteButton.svg"); background-image: url("@getImagePath(emoteButton/emoteButton.svg)");
background-repeat: none; background-repeat: none;
background-position: center; background-position: center;
border-top-right-radius: 5px; border-top-right-radius: 5px;

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -15,22 +15,22 @@ QRadioButton::indicator
QRadioButton::indicator:unchecked QRadioButton::indicator:unchecked
{ {
image: url(:/ui/emoticonWidget/dot_page.svg); image: url(@getImagePath(emoticonWidget/dot_page.svg));
} }
QRadioButton::indicator:unchecked:hover QRadioButton::indicator:unchecked:hover
{ {
image: url(:/ui/emoticonWidget/dot_page_hover.svg); image: url(@getImagePath(emoticonWidget/dot_page_hover.svg));
} }
QRadioButton::indicator:unchecked:pressed QRadioButton::indicator:unchecked:pressed
{ {
image: url(:/ui/emoticonWidget/dot_page_hover.svg); image: url(@getImagePath(emoticonWidget/dot_page_hover.svg));
} }
QRadioButton::indicator:checked QRadioButton::indicator:checked
{ {
image: url(:/ui/emoticonWidget/dot_page_current.svg); image: url(@getImagePath(emoticonWidget/dot_page_current.svg));
} }
QMenu QMenu

View File

@ -1,7 +1,7 @@
QPushButton QPushButton
{ {
background-color: #6bc260; background-color: #6bc260;
background-image: url(":/ui/fileButton/fileButton.svg"); background-image: url("@getImagePath(fileButton/fileButton.svg)");
background-repeat: none; background-repeat: none;
background-position: center; background-position: center;
border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 888 B

After

Width:  |  Height:  |  Size: 888 B

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,7 +1,7 @@
QPushButton QPushButton
{ {
background-color: #6bc260; background-color: #6bc260;
background-image: url(":/ui/screenshotButton/screenshotButton.svg"); background-image: url("@getImagePath(screenshotButton/screenshotButton.svg)");
background-repeat: none; background-repeat: none;
background-position: center; background-position: center;
border-top-left-radius: 5px; border-top-left-radius: 5px;

View File

Before

Width:  |  Height:  |  Size: 482 B

After

Width:  |  Height:  |  Size: 482 B

View File

@ -1,7 +1,7 @@
QPushButton QPushButton
{ {
background-color: #6bc260; background-color: #6bc260;
background-image: url(":/ui/sendButton/sendButton.svg"); background-image: url("@getImagePath(sendButton/sendButton.svg)");
background-repeat: none; background-repeat: none;
background-position: center; background-position: center;
border: none; border: none;

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 862 B

View File

@ -33,7 +33,7 @@ QPushButton::menu-indicator {image: none;}
QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open
{ {
image: url(":ui/statusButton/menu_indicator.svg"); image: url("@getImagePath(statusButton/menu_indicator.svg)");
subcontrol-origin: padding; subcontrol-origin: padding;
subcontrol-position: bottom center; subcontrol-position: bottom center;
position: relative; position: relative;

View File

@ -119,7 +119,7 @@ QListView
#statusPanel > #statusHead > #statusButton::menu-indicator:pressed, #statusPanel > #statusHead > #statusButton::menu-indicator:open #statusPanel > #statusHead > #statusButton::menu-indicator:pressed, #statusPanel > #statusHead > #statusButton::menu-indicator:open
{ {
image: url(":ui/statusButton/menu_indicator.png"); image: url("@getImagePath(statusButton/menu_indicator.svg)");
subcontrol-origin: padding; subcontrol-origin: padding;
subcontrol-position: bottom center; subcontrol-position: bottom center;
position: relative; position: relative;

View File

@ -35,38 +35,38 @@ QPushButton#minimizeButton
{ {
border: 0px solid transparent; border: 0px solid transparent;
background-color: transparent; background-color: transparent;
image: url(":ui/window/minimizeButton.png"); image: url("@getImagePath(window/minimizeButton.png)");
} }
QPushButton#minimizeButton:hover {image: url(":ui/window/minimizeButtonHover.png");} QPushButton#minimizeButton:hover {image: url("@getImagePath(window/minimizeButtonHover.png)");}
QPushButton#minimizeButton:pressed {image: url(":ui/window/minimizeButtonPressed.png");} QPushButton#minimizeButton:pressed {image: url("@getImagePath(window/minimizeButtonPressed.png)");}
QPushButton#minimizeButton:focus {outline: none;} QPushButton#minimizeButton:focus {outline: none;}
QPushButton#maximizeButton QPushButton#maximizeButton
{ {
border: 0px solid transparent; border: 0px solid transparent;
background-color: transparent; background-color: transparent;
image: url(":ui/window/maximizeButton.png"); image: url("@getImagePath(window/maximizeButton.png");
} }
QPushButton#maximizeButton:hover {image: url(":ui/window/maximizeButtonHover.png");} QPushButton#maximizeButton:hover {image: url("@getImagePath(window/maximizeButtonHover.png)");}
QPushButton#maximizeButton:pressed {image: url(":ui/window/maximizeButtonPressed.png");} QPushButton#maximizeButton:pressed {image: url("@getImagePath(window/maximizeButtonPressed.png)");}
QPushButton#maximizeButton:focus {outline: none;} QPushButton#maximizeButton:focus {outline: none;}
QPushButton#closeButton QPushButton#closeButton
{ {
border: 0px solid transparent; border: 0px solid transparent;
background-color: transparent; background-color: transparent;
image: url(":ui/window/closeButton.png"); image: url("@getImagePath(window/closeButton.png");
} }
QPushButton#closeButton:hover {image: url(":ui/window/closeButtonHover.png");} QPushButton#closeButton:hover {image: url("@getImagePath(window/closeButtonHover.png)");}
QPushButton#closeButton:pressed {image: url(":ui/window/closeButtonPressed.png");} QPushButton#closeButton:pressed {image: url("@getImagePath(window/closeButtonPressed.png)");}
QPushButton#closeButton:focus {outline: none;} QPushButton#closeButton:focus {outline: none;}
QPushButton#restoreButton QPushButton#restoreButton
{ {
border: 0px solid transparent; border: 0px solid transparent;
background-color: transparent; background-color: transparent;
image: url(":ui/window/restoreButton.png"); image: url("@getImagePath(window/restoreButton.png)");
} }
QPushButton#restoreButton:hover {image: url(":ui/window/restoreButtonHover.png");} QPushButton#restoreButton:hover {image: url("@getImagePath(window/restoreButtonHover.png)");}
QPushButton#restoreButton:pressed {image: url(":ui/window/restoreButtonPressed.png");} QPushButton#restoreButton:pressed {image: url("@getImagePath(window/restoreButtonPressed.png)");}
QPushButton#restoreButton:focus {outline: none;} QPushButton#restoreButton:focus {outline: none;}