Added new tool 'Changelog'

Provides in-app information about the changes between the various
versions
This commit is contained in:
Valentino Orlandi 2024-02-10 01:16:26 +01:00
parent 8955ab939b
commit d2fecd9552
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
9 changed files with 792 additions and 10 deletions

View File

@ -167,6 +167,12 @@ set(PROJECT_SOURCES
modules/crapinfo/modules/stylesheets.h
modules/crapinfo/modules/stylesheets.cpp
modules/changelog/changelog.ui
modules/changelog/changelog.h
modules/changelog/changelog.cpp
modules/changelog/modules/stylesheets.h
modules/changelog/modules/stylesheets.cpp
tools/crappath/crappath.h
tools/crappath/crappath.cpp

View File

@ -26,6 +26,8 @@
#include "modules/crapup/crapup.h"
#include "modules/crapinfo/crapinfo.h"
#include "modules/changelog/changelog.h"
#include "modules/craplog/lib.h"
#include "modules/crapview/lib.h"
@ -127,6 +129,7 @@ MainWindow::MainWindow(QWidget *parent)
connect( this->ui->actionBlockNote, &QAction::triggered, this, &MainWindow::menu_actionBlockNote_triggered );
// utilities
connect( this->ui->actionInfos, &QAction::triggered, this, &MainWindow::menu_actionInfos_triggered );
connect( this->ui->actionChangelog, &QAction::triggered, this, &MainWindow::menu_actionChangelog_triggered );
connect( this->ui->actionCheckUpdates, &QAction::triggered, this, &MainWindow::menu_actionCheckUpdates_triggered );
// games
connect( this->ui->actionCrissCross, &QAction::triggered, this, &MainWindow::menu_actionCrissCross_triggered );
@ -1572,6 +1575,7 @@ void MainWindow::updateUiFonts()
this->ui->actionBlockNote->setFont( menu_font );
this->ui->menuUtilities->setFont( menu_font );
this->ui->actionInfos->setFont( menu_font );
this->ui->actionChangelog->setFont( menu_font );
this->ui->actionCheckUpdates->setFont( menu_font );
this->ui->menuGames->setFont( menu_font );
this->ui->actionCrissCross->setFont( menu_font );
@ -2311,12 +2315,30 @@ void MainWindow::menu_actionBlockNote_triggered()
void MainWindow::menu_actionInfos_triggered()
{
this->crapinfo.reset( new Crapinfo(
QString::number( this->version ),
QString::fromStdString( this->resolvePath( "./" ) ),
QString::fromStdString( this->configs_path ),
QString::fromStdString( this->logdoc_path ) ) );
this->crapinfo->show();
if ( !this->crapinfo.isNull() && this->crapinfo->isVisible() ) {
this->crapinfo->activateWindow();
} else {
this->crapinfo.reset( new Crapinfo(
QString::number( this->version ),
QString::fromStdString( this->resolvePath( "./" ) ),
QString::fromStdString( this->configs_path ),
QString::fromStdString( this->logdoc_path ) ) );
this->crapinfo->show();
}
}
void MainWindow::menu_actionChangelog_triggered()
{
if ( !this->changelog.isNull() && this->changelog->isVisible() ) {
this->changelog->activateWindow();
} else {
this->changelog.reset( new Changelog(
this->fonts.at( "main" ),
this->TB.getFont() ) );
this->changelog->show();
}
}
void MainWindow::menu_actionCheckUpdates_triggered()
@ -4537,6 +4559,9 @@ void MainWindow::on_box_ConfTextBrowser_Font_currentIndexChanged(int index)
if ( !this->crapnote.isNull() ) {
this->crapnote->setTextFont( font );
}
if ( !this->changelog.isNull() ) {
this->changelog->setTextFont( font );
}
}
void MainWindow::on_checkBox_ConfTextBrowser_WideLines_clicked(bool checked)
{

View File

@ -23,6 +23,8 @@ class Crapup;
class Crapinfo;
class Crapnote;
class Changelog;
class CrissCross;
class SnakeGame;
@ -545,6 +547,8 @@ private slots:
void menu_actionInfos_triggered();
void menu_actionChangelog_triggered();
void menu_actionCheckUpdates_triggered();
//// GAMES ////
@ -940,6 +944,13 @@ private:
QSharedPointer<Crapinfo> crapinfo;
///////////////////
//// CRANGELOG ////
///////////////////
QSharedPointer<Changelog> changelog;
///////////////////
//// CRAPGAMES ////
///////////////////

View File

@ -2727,7 +2727,7 @@ Use '!', '=','&lt;' or '&gt;' to declare what to use</string>
<widget class="QWidget" name="scrollAreaContent_StatsCount">
<property name="geometry">
<rect>
<x>14</x>
<x>0</x>
<y>0</y>
<width>263</width>
<height>402</height>
@ -8582,7 +8582,7 @@ Any field not considered by LogDoctor will appear as 'DISCARDED'</string>
<rect>
<x>0</x>
<y>0</y>
<width>648</width>
<width>98</width>
<height>54</height>
</rect>
</property>
@ -9456,7 +9456,7 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log
<rect>
<x>0</x>
<y>0</y>
<width>648</width>
<width>98</width>
<height>54</height>
</rect>
</property>
@ -10654,7 +10654,7 @@ Any field not considered by LogDoctor will appear as 'DISCARDED'</string>
<rect>
<x>0</x>
<y>0</y>
<width>648</width>
<width>98</width>
<height>54</height>
</rect>
</property>
@ -11406,6 +11406,7 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log
<string>Utilities</string>
</property>
<addaction name="actionInfos"/>
<addaction name="actionChangelog"/>
<addaction name="actionCheckUpdates"/>
</widget>
<widget class="QMenu" name="menuTools">
@ -11511,6 +11512,9 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log
<property name="text">
<string>Infos</string>
</property>
<property name="toolTip">
<string>Show some info about LogDoctor</string>
</property>
</action>
<action name="actionBlockNote">
<property name="text">
@ -11560,6 +11564,14 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log
<string notr="true">Português</string>
</property>
</action>
<action name="actionChangelog">
<property name="text">
<string>Changelog</string>
</property>
<property name="toolTip">
<string>Show the changelog</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -0,0 +1,229 @@
#include "changelog.h"
#include "ui_changelog.h"
#include "modules/stylesheets.h"
#include "modules/exceptions.h"
Changelog::Changelog( const QFont& font, const QFont& tb_font, QWidget *parent )
: QWidget{ parent }
, ui{ new Ui::Changelog }
{
this->ui->setupUi(this);
this->setFont( font );
this->ui->tree_Versions->setFont( font );
this->ui->text_Logs->setFont( tb_font );
this->setStyleSheet( StyleSec::Changelog::getStyleSheet() );
}
void Changelog::setTextFont( const QFont& font ) noexcept
{
this->ui->text_Logs->setFont( font );
}
void Changelog::on_tree_Versions_itemClicked(QTreeWidgetItem* item, int index)
{
Q_UNUSED(index)
static const QRegularExpression regex{ R"(^v[0-9]{1}\.[0-9]{2,2}$)" };
const QString version{ item->text(0) };
if ( ! regex.match( version ).hasMatch() ) {
return;
}
QString content{ QStringLiteral(R"(<!DOCTYPE html><html><head><style>li.elem{margin-top:10px;}</style></head><body><h2>%1</h2><ul>)").arg( version ) };
if ( version == "v1.00" ) {
content.append( R"(<li class="elem">)" );
content.append( tr("C++17") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Qt5") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Build scripts") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Cross-platform compatibility:") );
content.append( R"(<ul><li>)" );
content.append( tr("Linux") );
content.append( R"(</li><li>)" );
content.append( tr("BSD") );
content.append( R"(</li><li>)" );
content.append( tr("Windows") );
content.append( R"(</li><li>)" );
content.append( tr("OSX") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Statistics:") );
content.append( R"(<ul><li>)" );
content.append( tr("Warnings") );
content.append( R"(</li><li>)" );
content.append( tr("Speed") );
content.append( R"(</li><li>)" );
content.append( tr("Counts") );
content.append( R"(</li><li>)" );
content.append( tr("Daytime") );
content.append( R"(</li><li>)" );
content.append( tr("Relational") );
content.append( R"(</li><li>)" );
content.append( tr("Globals") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Translations:") );
content.append( R"(<ul><li>)" );
content.append( tr("Italian") );
content.append( R"(</li><li>)" );
content.append( tr("Spanish") );
content.append( R"(</li><li>)" );
content.append( tr("French") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Tools:") );
content.append( R"(<ul><li>)" );
content.append( tr("Block note") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Utilities:") );
content.append( R"(<ul><li>)" );
content.append( tr("Infos viewer") );
content.append( R"(</li><li>)" );
content.append( tr("Updates checker") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Themes:") );
content.append( R"(<ul><li>)" );
content.append( tr("Dark") );
content.append( R"(</li><li>)" );
content.append( tr("Light") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><p></p>)" ); // leave the p tag
} else if ( version == "v1.01" ) {
content.append( R"(<li class="elem">)" );
content.append( tr("Improvements and fixes") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("New themes:") );
content.append( R"(<ul><li>)" );
content.append( tr("Ash") );
content.append( R"(</li><li>)" );
content.append( tr("Candy") );
content.append( R"(</li><li>)" );
content.append( tr("Forest").append(" ← <i>").append(tr("Dark")).append("</i>") );
content.append( R"(</li><li>)" );
content.append( tr("Powder").append(" ← <i>").append(tr("Light")).append("</i>") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><p></p>)" ); // leave the p tag
} else if ( version == "v2.00" ) {
content.append( R"(<li class="elem">)" );
content.append( tr("Improvements and fixes") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Restyled GUI") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Restyled dialogs") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Doxygen documentation") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Mini-Games:") );
content.append( R"(<ul><li>)" );
content.append( tr("Criss-cross") );
content.append( R"(</li><li>)" );
content.append( tr("Snake") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><p></p>)" ); // leave the p tag
} else if ( version == "v2.01" ) {
content.append( R"(<li class="elem">)" );
content.append( tr("Improvements and fixes") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Changed default paths") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("New game modes for Snake") );
content.append( R"(<ul><li>)" );
content.append( tr("Hunt") );
content.append( R"(</li><li>)" );
content.append( tr("Battle") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><p></p>)" ); // leave the p tag
} else if ( version == "v2.02" ) {
content.append( R"(<li class="elem">)" );
content.append( tr("Improvements and fixes") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("New translations:") );
content.append( R"(<ul><li>)" );
content.append( tr("Japanese") );
content.append( R"(</li><li>)" );
content.append( tr("Portuguese") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><p></p>)" ); // leave the p tag
} else if ( version == "v2.03" ) {
content.append( R"(<li class="elem">)" );
content.append( tr("Improvements and fixes") );
content.append( R"(</li><p></p>)" ); // leave the p tag
} else if ( version == "v2.04" ) {
content.append( R"(<li class="elem">)" );
content.append( tr("Code improvements") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Performance improvements") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Added tests suite:") );
content.append( R"(<ul><li>)" );
content.append( tr("white box tests") );
content.append( R"(</li></ul>)" );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Customized charts themes") );
content.append( R"(</li><p></p>)" ); // leave the p tag
} else if ( version == "v2.05" ) {
content.append( R"(<li class="elem">)" );
content.append( tr("Fixes") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Code improvements") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Performance improvements") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Tests improvements") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Docker support") );
content.append( R"(</li><p></p>)" ); // leave the p tag
} else if ( version == "v3.00" ) {
content.append( R"(<li class="elem">)" );
content.append( tr("Upgrade to C++20") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Upgrade to Qt6") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Restyled themes") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Redesigned configs section") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Code improvements") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Tests improvements") );
content.append( R"(</li><li class="elem">)" );
content.append( tr("Fixes") );
content.append( R"(</li><p></p>)" ); // leave the p tag
} else {
throw DoNotCatchException( "Unexpected changelog version", version.toStdString() );
}
content.append( QStringLiteral("</ul></body></html>") );
this->ui->text_Logs->setText( content );
}

View File

@ -0,0 +1,37 @@
#ifndef LOGDOCTOR__CHANGELOG_H
#define LOGDOCTOR__CHANGELOG_H
#include <QWidget>
class QTreeWidgetItem;
namespace Ui {
class Changelog;
}
//! Changelog
/*!
Displays information about the changes between the various versions of LogDoctor
*/
class Changelog : public QWidget
{
Q_OBJECT
public:
explicit Changelog( const QFont& font, const QFont& tb_font, QWidget* parent=nullptr );
//! Sets the given font for the changelog info
void setTextFont( const QFont& font ) noexcept;
private slots:
void on_tree_Versions_itemClicked(QTreeWidgetItem* item, int index);
private:
QSharedPointer<Ui::Changelog> ui;
};
#endif // LOGDOCTOR__CHANGELOG_H

View File

@ -0,0 +1,215 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Changelog</class>
<widget class="QWidget" name="Changelog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>600</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="windowTitle">
<string notr="true">LogDoctor - Changelog</string>
</property>
<property name="windowIcon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/logo/logo/logdoctor.svg</normaloff>:/logo/logo/logdoctor.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget_Main" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="leftMargin">
<number>16</number>
</property>
<property name="topMargin">
<number>16</number>
</property>
<property name="rightMargin">
<number>16</number>
</property>
<property name="bottomMargin">
<number>16</number>
</property>
<item>
<widget class="QTreeWidget" name="tree_Versions">
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>180</width>
<height>16777215</height>
</size>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="animated">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Versions</string>
</property>
</column>
<item>
<property name="text">
<string>Version 3</string>
</property>
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
<item>
<property name="text">
<string notr="true">v3.00</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
</item>
<item>
<property name="text">
<string>Version 2</string>
</property>
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
<item>
<property name="text">
<string notr="true">v2.05</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string notr="true">v2.04</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string notr="true">v2.03</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string notr="true">v2.02</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string notr="true">v2.01</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string notr="true">v2.00</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
</item>
<item>
<property name="text">
<string>Version 1</string>
</property>
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
<item>
<property name="text">
<string notr="true">v1.01</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string notr="true">v1.00</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
</item>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="text_Logs">
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
hr { height: 1px; border-width: 0; }
li.unchecked::marker { content: &quot;\2610&quot;; }
li.checked::marker { content: &quot;\2612&quot;; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,227 @@
#include "stylesheets.h"
#include "globals/global_configs.h"
#include "modules/exceptions.h"
#include <QString>
#include <QtCore/QStringBuilder>
#include <unordered_map>
namespace /*private*/
{
enum StyleId : uint32_t {
TEXT,
WINDOW_PRIMARY,
VERSIONS_TREE_BASE,
VERSIONS_TREE_BASE_SELECTION,
TEXTBROWSER_TEXT,
TEXTBROWSER_BASE,
TEXTBROWSER_BORDER,
TEXTBROWSER_TEXT_SELECTION,
TEXTBROWSER_BASE_SELECTION,
SCROLLBAR_BASE,
SCROLLBAR_HANDLER,
SCROLLBAR_CONTROLS,
TABLES_HEADER,
TABLES_HEADER_HOVER,
TABLES_DECO
};
using StyleMap = std::unordered_map<StyleId, QString>;
StyleMap makeStyleMap()
{
switch ( GlobalConfigs::window_theme ) {
case WindowTheme::Light:
return {
{TEXT,
"rgb( 22, 11, 0 )"},
{WINDOW_PRIMARY,
"rgb( 230, 230, 230 )"},
{VERSIONS_TREE_BASE,
"rgb( 245, 245, 247 )"},
{VERSIONS_TREE_BASE_SELECTION,
"rgb( 220, 220, 222 )"},
{TEXTBROWSER_TEXT,
"rgb( 88, 80, 80 )"},
{TEXTBROWSER_BASE,
"rgb( 250, 250, 255 )"},
{TEXTBROWSER_BORDER,
"rgb( 236, 236, 236 )"},
{TEXTBROWSER_TEXT_SELECTION,
"rgb( 68, 60, 60 )"},
{TEXTBROWSER_BASE_SELECTION,
"rgb( 207, 201, 195 )"},
{SCROLLBAR_BASE,
"transparent"},
{SCROLLBAR_HANDLER,
"rgb( 40, 185, 40 )"},
{SCROLLBAR_CONTROLS,
"transparent"},
{TABLES_HEADER,
"rgb( 220, 220, 220 )"},
{TABLES_HEADER_HOVER,
"rgb( 201, 239, 255 )"},
{TABLES_DECO,
"rgb( 99, 188, 255 )"}
};
case WindowTheme::Dark:
return {
{TEXT,
"rgb( 248, 248, 248 )"},
{WINDOW_PRIMARY,
"rgb( 27, 30, 33 )"},
{VERSIONS_TREE_BASE,
"rgb( 20, 21, 22 )"},
{VERSIONS_TREE_BASE_SELECTION,
"rgb( 40, 42, 44 )"},
{TEXTBROWSER_TEXT,
"rgb( 210, 210, 210 )"},
{TEXTBROWSER_BASE,
"rgb( 13, 14, 15 )"},
{TEXTBROWSER_BORDER,
"rgb( 32, 32, 32 )"},
{TEXTBROWSER_TEXT_SELECTION,
"rgb( 248, 248, 248 )"},
{TEXTBROWSER_BASE_SELECTION,
"rgb( 64, 64, 64 )"},
{SCROLLBAR_BASE,
"transparent"},
{SCROLLBAR_HANDLER,
"rgb( 69, 177, 255 )"},
{SCROLLBAR_CONTROLS,
"transparent"},
{TABLES_HEADER,
"rgb( 50, 52, 50 )"},
{TABLES_HEADER_HOVER,
"rgb( 43, 82, 43 )"},
{TABLES_DECO,
"rgb( 10, 155, 10 )"}
};
default:
throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast<themes_t>(GlobalConfigs::window_theme)) );
}
}
} //namespace (private)
namespace StyleSec::Changelog
{
QString getStyleSheet()
{
if ( GlobalConfigs::window_theme == WindowTheme::Native ) {
return "";
}
const StyleMap style{ makeStyleMap() };
return
"QWidget#Changelog {"
" color: "% style.at(TEXT) %";"
" background-color: "% style.at(WINDOW_PRIMARY) %";"
"}"
"QFrame {"
" border: 0px;"
" background-color: transparent;"
"}"
// versions
"QTreeView {"
" border-radius: 8px;"
" color: "% style.at(TEXT) %";"
" background-color: "% style.at(VERSIONS_TREE_BASE) %";"
" selection-color: "% style.at(TEXT) %";"
" selection-background-color: "% style.at(VERSIONS_TREE_BASE_SELECTION) %";"
"}"
"QTreeView QScrollBar::sub-line:vertical {"
" margin-top: -12px;"
" border: 0px;"
" border-top-right-radius: 8px;"
" background-color: transparent;"
"}"
"QTreeView QScrollBar::handle:vertical,"
"QTreeView QScrollBar::handle:vertical:hover {"
" margin-top: 32px;"
"}"
"QTreeView QScrollBar::sub-line:vertical,"
"QTableView QScrollBar::sub-line:vertical {"
" margin-top: -12px;"
" height: 24px;"
" border: 0px;"
" border-top-right-radius: 8px;"
" border-bottom: 2px solid "% style.at(TABLES_DECO) %";"
" background-color: "% style.at(TABLES_HEADER) %";"
"}"
// text browser
"QTextBrowser {"
" border: 4px solid "% style.at(TEXTBROWSER_BORDER) %";"
" border-radius: 8px;"
" color: "% style.at(TEXTBROWSER_TEXT) %";"
" background-color: "% style.at(TEXTBROWSER_BASE) %";"
" selection-color: "% style.at(TEXTBROWSER_TEXT_SELECTION) %";"
" selection-background-color: "% style.at(TEXTBROWSER_BASE_SELECTION) %";"
"}"
"QTextBrowser QScrollBar::handle:vertical {"
" padding: 12px;"
"}"
// scroll-bars
"QScrollBar {"
" border: 0px solid transparent;"
"}"
"QScrollBar:horizontal {"
" height: 12px;"
" background-color: "% style.at(SCROLLBAR_BASE) %";"
"}"
"QScrollBar::handle:horizontal {"
" min-width: 16px;"
" margin: 5px 0px 5px 0px;"
" background-color: "% style.at(SCROLLBAR_HANDLER) %";"
"}"
"QScrollBar::handle:horizontal:hover {"
" margin: 4px 0px 4px 0px;"
" border-radius: 2px;"
"}"
"QScrollBar:vertical {"
" width: 12px;"
" background-color: "% style.at(SCROLLBAR_BASE) %";"
"}"
"QScrollBar::handle:vertical {"
" min-width: 16px;"
" margin: 0px 5px 0px 5px;"
" background-color: "% style.at(SCROLLBAR_HANDLER) %";"
"}"
"QScrollBar::handle:vertical:hover {"
" margin: 0px 4px 0px 4px;"
" border-radius: 2px;"
"}"
"QScrollBar::add-line,"
"QScrollBar::sub-line,"
"QScrollBar::add-pae,"
"QScrollBar::sub-pae,"
"QScrollBar::up-arrow,"
"QScrollBar::down-arrow,"
"QScrollBar::left-arrow,"
"QScrollBar::right-arrow {"
" border: 0px;"
" background-color: "% style.at(SCROLLBAR_CONTROLS) %";"
"}"
// tree header
"QHeaderView::section {"
" height: 24px;"
" padding-left: 6px;"
" border-top-left-radius: 6px;"
" border-top-right-radius: 6px;"
" color: "% style.at(TEXT) %";"
" border-bottom: 2px solid "% style.at(TABLES_DECO) %";"
" background-color: "% style.at(TABLES_HEADER) %";"
"}"
"QHeaderView::section::hover {"
" background-color: "% style.at(TABLES_HEADER_HOVER) %";"
"}";
}
} // namespace StyleSec::Changelog

View File

@ -0,0 +1,20 @@
#ifndef LOGDOCTOR__CHANGELOG__STYLESHEETS_H
#define LOGDOCTOR__CHANGELOG__STYLESHEETS_H
class QString;
namespace StyleSec::Changelog
{
//! Returns the proper style sheet
/*!
\throw DoNotCatchException
*/
QString getStyleSheet();
} // namespace StyleSec::Changelog
#endif // LOGDOCTOR__CHANGELOG__STYLESHEETS_H