Commit aad2bfd6 authored by Johannes Zarl-Zierl's avatar Johannes Zarl-Zierl

Unify stylesheets and set them at an application level.

parent 27736821
......@@ -49,11 +49,6 @@ constexpr int SCALE_BOTTOM = 0b00000010;
constexpr int SCALE_RIGHT = 0b00000100;
constexpr int SCALE_LEFT = 0b00001000;
constexpr int MOVE = 0b10000000;
const QString STYLESHEET = QString::fromUtf8(
"AnnotationDialog--ResizableFrame { color: rgb(255,0,0); }"
"AnnotationDialog--ResizableFrame:hover { background-color: rgb(255,255,255,30); }"
"AnnotationDialog--ResizableFrame[associated=true] { color: rgb(0,255,0); }");
}
AnnotationDialog::ResizableFrame::ResizableFrame(QWidget *parent)
......@@ -64,7 +59,6 @@ AnnotationDialog::ResizableFrame::ResizableFrame(QWidget *parent)
setFrameShape(QFrame::Box);
setMouseTracking(true);
setStyleSheet(STYLESHEET);
m_removeAct = new QAction(
i18nc("area of an image; rectangle that is overlayed upon the image",
......
......@@ -40,12 +40,18 @@ namespace AnnotationDialog
/**
* @brief The ResizableFrame class represents a positionable tag in the annotation dialog.
* It has two basic states: associated to a tag, and unassociated.
* A context menu is provided to allow associating the ResizableFrame with a tag,
*
* An AreaTagSelectDialog provides the context menu to allow associating the ResizableFrame with a tag,
* as well as removing the tag, or removing the area completely.
*
* If an area is removed, the associated tag is usually removed from the image as well.
*
* ## Styling
* The frame is styled based on this state (see property \c associated).
* The following styles are expected to be set for a proper appearance of ResizableFrame:
* - `AnnotationDialog--ResizableFrame`
* - `AnnotationDialog--ResizableFrame:hover`
* - `AnnotationDialog--ResizableFrame[associated="true"]`
*/
class ResizableFrame : public QFrame
{
......
/* Copyright (C) 2014-2019 The KPhotoAlbum Development Team
/* Copyright (C) 2014-2020 The KPhotoAlbum Development Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
......@@ -25,12 +25,6 @@ Viewer::TaggedArea::TaggedArea(QWidget *parent)
: QFrame(parent)
{
setFrameShape(QFrame::Box);
setStyleSheet(QStringLiteral(
"Viewer--TaggedArea { border: none; background-color: none; }"
"Viewer--TaggedArea:hover, Viewer--TaggedArea[selected=\"true\"] {"
" border: 1px solid rgb(0,255,0,99); background-color: rgb(255,255,255,30);"
" }"
"Viewer--TaggedArea[highlighted=\"true\"]{ border: 1px solid rgb(255,128,0,99); background-color: rgb(255,255,255,30); }"));
}
void Viewer::TaggedArea::setTagInfo(QString category, QString localizedCategory, QString tag)
......
......@@ -27,7 +27,12 @@ namespace Viewer
* @brief The TaggedArea class represents a positionable tag in the viewer.
* It does not allow any manipulation of the tag data.
*
* ## Styling
* The appearance is based on the properties selected() and highlighted().
* The following styles are expected to be set for a proper appearance of TaggedArea:
* - `Viewer--TaggedArea`
* - `Viewer--TaggedArea:hover`
* - `Viewer--TaggedArea[highlighted="true"]`
*/
class TaggedArea : public QFrame
{
......
......@@ -44,6 +44,19 @@
Q_DECLARE_LOGGING_CATEGORY(MainLog)
Q_LOGGING_CATEGORY(MainLog, "kphotoalbum", QtWarningMsg)
namespace
{
const auto STYLE = QStringLiteral(
"Viewer--TaggedArea { border: none; background-color: none; }"
"Viewer--TaggedArea:hover, Viewer--TaggedArea[selected=\"true\"] {"
" border: 1px solid rgb(0,255,0,99); background-color: rgb(255,255,255,30);"
" }"
"Viewer--TaggedArea[highlighted=\"true\"]{ border: 1px solid rgb(255,128,0,99); background-color: rgb(255,255,255,30); }"
"AnnotationDialog--ResizableFrame { color: rgb(255,0,0); }"
"AnnotationDialog--ResizableFrame:hover { background-color: rgb(255,255,255,30); }"
"AnnotationDialog--ResizableFrame[associated=true] { color: rgb(0,255,0); }");
}
void migrateKDE4Config()
{
Kdelibs4ConfigMigrator migrator(QStringLiteral("kphotoalbum")); // the same name defined in the aboutData
......@@ -120,6 +133,7 @@ int main(int argc, char **argv)
const QString schemePath = KSharedConfig::openConfig()->group("General").readEntry(QString::fromLatin1("colorScheme"), QString());
qCDebug(MainLog) << "Loading color scheme from " << (schemePath.isEmpty() ? QString::fromLatin1("system default") : schemePath);
app.setPalette(KColorScheme::createApplicationPalette(KSharedConfig::openConfig(schemePath)));
app.setStyleSheet(STYLE);
new MainWindow::SplashScreen();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment