-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More styling and use Phantom as base style
- Loading branch information
Showing
21 changed files
with
6,382 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (C) 2020 KeePassXC Team <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 2 or (at your option) | ||
* version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <QFile> | ||
#include <QStyleFactory> | ||
|
||
#include "gui/styles/phantomstyle/phantomstyle.h" | ||
#include "BaseStyle.h" | ||
|
||
BaseStyle::BaseStyle() | ||
{ | ||
setBaseStyle(new PhantomStyle); | ||
} | ||
|
||
BaseStyle::BaseStyle(QProxyStyle* style) | ||
: QProxyStyle(style) | ||
{ | ||
} | ||
|
||
void BaseStyle::polish(QApplication* app) | ||
{ | ||
Q_INIT_RESOURCE(styles); | ||
QString stylesheet; | ||
|
||
QFile baseStylesheetFile(":/styles/base/basestyle.qss"); | ||
if (baseStylesheetFile.open(QIODevice::ReadOnly | QIODevice::Text)) { | ||
stylesheet = baseStylesheetFile.readAll(); | ||
baseStylesheetFile.close(); | ||
} else { | ||
qWarning("Failed to load theme base stylesheet."); | ||
} | ||
|
||
QFile extensionStyleSheetFile(getStylesheetPath()); | ||
if (extensionStyleSheetFile.open(QIODevice::ReadOnly | QIODevice::Text)) { | ||
stylesheet.append(extensionStyleSheetFile.readAll()); | ||
extensionStyleSheetFile.close(); | ||
} else { | ||
qWarning("Failed to load theme extension stylesheet."); | ||
} | ||
|
||
app->setStyleSheet(stylesheet); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2020 KeePassXC Team <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 2 or (at your option) | ||
* version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef KEEPASSXC_BASESTYLE_H | ||
#define KEEPASSXC_BASESTYLE_H | ||
|
||
#include <QApplication> | ||
#include <QProxyStyle> | ||
|
||
class BaseStyle : public QProxyStyle | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
BaseStyle(); | ||
explicit BaseStyle(QProxyStyle* style); | ||
|
||
using QProxyStyle::polish; | ||
void polish(QApplication* app) override; | ||
|
||
protected: | ||
/** | ||
* @return Path to stylesheet which extends basestyle.qss | ||
*/ | ||
virtual QString getStylesheetPath() const = 0; | ||
}; | ||
|
||
|
||
#endif //KEEPASSXC_BASESTYLE_H |
Oops, something went wrong.