Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
a56b523
fix: The start widget now adjusts to the system theme
AlexandrKudrya Nov 14, 2024
4af3500
fix: Remove hardcode from circleWidget and startWidget
AlexandrKudrya Nov 14, 2024
3f92faf
fix: Search line background adjusting to system theme
AlexandrKudrya Nov 14, 2024
dac2b73
feat: unified style placing
AlexandrKudrya Nov 15, 2024
1934397
fix: new color schemes
AlexandrKudrya Nov 15, 2024
a0163b9
fix: Grid style
AlexandrKudrya Nov 15, 2024
70d985b
fix: Palette icons background (bad)
AlexandrKudrya Nov 18, 2024
eca794f
fix: Adding new translations
AlexandrKudrya Nov 19, 2024
1b325d5
fix: linter fixes
AlexandrKudrya Nov 19, 2024
cbb29fb
fix: fix translations
AlexandrKudrya Nov 21, 2024
6ab139e
fix: place Style replace
AlexandrKudrya Nov 29, 2024
715b3bc
fix: hotkeyManager theme
AlexandrKudrya Nov 29, 2024
6867f26
fix: translations
AlexandrKudrya Nov 29, 2024
22b8829
fix: Edit and find Action coloring
AlexandrKudrya Nov 29, 2024
d8f4baf
fix: Lint fix
AlexandrKudrya Nov 29, 2024
a2873eb
fix: Scope
AlexandrKudrya Nov 29, 2024
74cd8f8
fix: Labels text color
AlexandrKudrya Dec 18, 2024
f2521bb
fix: Icons color
AlexandrKudrya Dec 19, 2024
15e1832
fix: other icons color
AlexandrKudrya Dec 19, 2024
d196f35
fix: arrow color
AlexandrKudrya Dec 19, 2024
fccf241
fix: translations
AlexandrKudrya Dec 19, 2024
76d3a87
fix: lint
AlexandrKudrya Dec 19, 2024
bd95582
fix: lint
AlexandrKudrya Dec 19, 2024
fc97556
fix: The start widget now adjusts to the system theme
AlexandrKudrya Nov 14, 2024
f3f0304
fix: Remove hardcode from circleWidget and startWidget
AlexandrKudrya Nov 14, 2024
d8609d7
fix: Search line background adjusting to system theme
AlexandrKudrya Nov 14, 2024
452bdde
feat: unified style placing
AlexandrKudrya Nov 15, 2024
c8f9e73
fix: new color schemes
AlexandrKudrya Nov 15, 2024
2168424
fix: Grid style
AlexandrKudrya Nov 15, 2024
72498bd
fix: Palette icons background (bad)
AlexandrKudrya Nov 18, 2024
e00e3d3
fix: Adding new translations
AlexandrKudrya Nov 19, 2024
06a8e30
fix: linter fixes
AlexandrKudrya Nov 19, 2024
f5a4352
fix: fix translations
AlexandrKudrya Nov 21, 2024
c39181d
fix: place Style replace
AlexandrKudrya Nov 29, 2024
af462aa
fix: hotkeyManager theme
AlexandrKudrya Nov 29, 2024
8560877
fix: translations
AlexandrKudrya Nov 29, 2024
6804abb
fix: Edit and find Action coloring
AlexandrKudrya Nov 29, 2024
add0c6c
fix: Lint fix
AlexandrKudrya Nov 29, 2024
8fa1e06
fix: Scope
AlexandrKudrya Nov 29, 2024
cd35ed0
fix: Labels text color
AlexandrKudrya Dec 18, 2024
2d954b0
fix: Icons color
AlexandrKudrya Dec 19, 2024
e09da3d
fix: other icons color
AlexandrKudrya Dec 19, 2024
ff652e9
fix: arrow color
AlexandrKudrya Dec 19, 2024
3114e04
fix: translations
AlexandrKudrya Dec 19, 2024
89f6ba2
fix: lint
AlexandrKudrya Dec 19, 2024
5b68de7
fix: lint
AlexandrKudrya Dec 19, 2024
7520ad5
fix: AbstactItem includes
AlexandrKudrya Dec 19, 2024
a8c8af6
fix: translations add
AlexandrKudrya Dec 19, 2024
5d8ea8e
fix: edgeElement includes
AlexandrKudrya Dec 19, 2024
10bec97
fix: some more icons coloring
AlexandrKudrya Dec 19, 2024
4e18e68
fix: delete ui_twoModelWidgets
AlexandrKudrya Dec 19, 2024
aa6f674
fix: adding color adjusting to 2d mode icons
AlexandrKudrya Dec 19, 2024
c783be9
fix: adding color adjusting to 2d mode icons translations
AlexandrKudrya Dec 19, 2024
bb5ac56
feat: DarkPalette for windows
AlexandrKudrya Dec 19, 2024
25b3274
fix: translation fixes
AlexandrKudrya Dec 19, 2024
a206e2e
fix: lint fix
AlexandrKudrya Dec 19, 2024
c77a99a
fix: mainWidget include
AlexandrKudrya Dec 19, 2024
523762b
Merge branch 'develop' into windows-hardcode-fix
AlexandrKudrya Dec 25, 2024
a8df063
fix: little fixes
AlexandrKudrya Dec 26, 2024
e230896
Merge branch 'develop' into windows-hardcode-fix
AlexandrKudrya Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ void TwoDModelWidget::initWidget()
};
toggleRulers();

mUi->speedUpButton->setIcon(AbstractItem::loadTextColorIcon(":/icons/2d_plus.svg"));
mUi->speedDownButton->setIcon(AbstractItem::loadTextColorIcon(":/icons/2d_minus.svg"));
mUi->initialStateButton->setIcon(AbstractItem::loadTextColorIcon(":/icons/2d_robot_back.png"));
mUi->trainingModeButton->setIcon(AbstractItem::loadTextColorIcon(":/icons/2d_training.svg"));
mUi->toggleDetailsButton->setIcon(AbstractItem::loadTextColorIcon(":/icons/2d_left.png"));

connect(mUi->gridParametersBox, &twoDModel::view::GridParameters::parametersChanged
, &*mScene, [&]() { mScene->update(); });
connect(mUi->gridParametersBox, &GridParameters::parametersChanged, this, toggleRulers);
Expand Down
20 changes: 10 additions & 10 deletions qrgui/brandManager/styles.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,60 +37,60 @@ class Styles
/// Returns json stylesheet for start tab background
virtual QString startTabBackgroundStyle() const
{
return placeStyle(utils::InFile::readAll(startTabBackgroundStylePath()));
return loadSystemPallete(utils::InFile::readAll(startTabBackgroundStylePath()));
}

/// Returns json stylesheet for start tab substrate background
virtual QString startTabSubstrateBackgroundStyle() const
{
return placeStyle(utils::InFile::readAll(startTabSubstrateBackgroundStylePath()));
return loadSystemPallete(utils::InFile::readAll(startTabSubstrateBackgroundStylePath()));
}

/// Returns json stylesheet for start tab header background
virtual QString startTabHeaderBackgroundStyle() const
{
return placeStyle(utils::InFile::readAll(startTabHeaderBackgroundStylePath()));
return loadSystemPallete(utils::InFile::readAll(startTabHeaderBackgroundStylePath()));
}

/// Returns json stylesheet for recent projects section background on start tab
virtual QString startTabRecentProjectsBackgroundStyle() const
{
return placeStyle(utils::InFile::readAll(startTabRecentProjectsBackgroundStylePath()));
return loadSystemPallete(utils::InFile::readAll(startTabRecentProjectsBackgroundStylePath()));
}

/// Returns json stylesheet for projects management section background on start tab
virtual QString startTabProjectsManagementBackgroundStyle() const
{
return placeStyle(utils::InFile::readAll(startTabProjectsManagementBackgroundStylePath()));
return loadSystemPallete(utils::InFile::readAll(startTabProjectsManagementBackgroundStylePath()));
}

/// Returns json stylesheet for command buttons on start tab
virtual QString startTabButtonStyle() const
{
return placeStyle(utils::InFile::readAll(startTabButtonStylePath()));
return loadSystemPallete(utils::InFile::readAll(startTabButtonStylePath()));
}

/// Returns json stylesheet for styled text on start tab of level 1 heading
virtual QString startTabLabelLevel1Style() const
{
return placeStyle(utils::InFile::readAll(startTabLabelLevel1StylePath()));
return loadSystemPallete(utils::InFile::readAll(startTabLabelLevel1StylePath()));
}

/// Returns json stylesheet for styled text on start tab of level 2 heading
virtual QString startTabLabelLevel2Style() const
{
return placeStyle(utils::InFile::readAll(startTabLabelLevel2StylePath()));
return loadSystemPallete(utils::InFile::readAll(startTabLabelLevel2StylePath()));
}

virtual QString splashscreenStyle() const
{
return placeStyle(utils::InFile::readAll(splashscreenStylePath()));
return loadSystemPallete(utils::InFile::readAll(splashscreenStylePath()));
}

protected:

///
QString placeStyle(QString style) const {
QString loadSystemPallete(QString style) const {
auto systemPalette(QApplication::palette());
return style
.replace("@@Window@@", systemPalette.color(QPalette::Window).name())
Expand Down
1 change: 1 addition & 0 deletions qrgui/editor/edgeElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <QtWidgets/QStyle>
#include <QtGui/QTextDocument>
#include <QtWidgets/QMenu>
#include <QApplication>

#include <math.h>
#include <qrkernel/logging.h>
Expand Down
1 change: 0 additions & 1 deletion qrgui/editor/labels/label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ void Label::init()
QGraphicsTextItem::setFlags(ItemIsSelectable);
QGraphicsTextItem::setDefaultTextColor(Qt::black);
connect(document(), &QTextDocument::contentsChanged, this, &Label::saveToRepo);

reinitFont();
setRotation(mProperties->rotation());
if (!mProperties->isStatic()) {
Expand Down
54 changes: 54 additions & 0 deletions qrgui/mainWindow/mainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <QtPrintSupport/QPrinter>
#include <QtPrintSupport/QPrintDialog>
#include <QtSvg/QSvgGenerator>
#include <QOperatingSystemVersion>

#include <qrkernel/settingsManager.h>
#include <qrkernel/settingsListener.h>
Expand Down Expand Up @@ -115,6 +116,7 @@ MainWindow::MainWindow(const QString &fileToOpen)
, mInitialFileToOpen(fileToOpen)
{
QLOG_INFO() << "MainWindow: screen DPI is" << logicalDpiX();
initPalette();
mUi->setupUi(this);
mUi->paletteTree->initMainWindow(this);
setWindowTitle("QReal");
Expand Down Expand Up @@ -643,6 +645,58 @@ void MainWindow::setReference(const QStringList &data, const QPersistentModelInd
}
}

bool MainWindow::windowsDarkThemeAvailiable()
{
if ( QOperatingSystemVersion::current().majorVersion() == 10 )
{
return QOperatingSystemVersion::current().microVersion() >= 17763;
}
else if ( QOperatingSystemVersion::current().majorVersion() > 10 )
{
return true;
}
else
{
return false;
}
}

bool MainWindow::windowsIsInDarkTheme()
{
QSettings settings(
"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"
, QSettings::NativeFormat );
return settings.value( "AppsUseLightTheme", 1 ).toInt() == 0;
}

void MainWindow::initPalette() {
if (QSysInfo::productType() != "windows") return ;
if (windowsDarkThemeAvailiable() && windowsIsInDarkTheme()) {
auto palette = QApplication::palette();
palette.setColor(QPalette::Window,QColor(53,53,53));
palette.setColor(QPalette::WindowText,Qt::white);
palette.setColor(QPalette::Disabled,QPalette::WindowText,QColor(127,127,127));
palette.setColor(QPalette::Base,QColor(42,42,42));
palette.setColor(QPalette::AlternateBase,QColor(66,66,66));
palette.setColor(QPalette::ToolTipBase,Qt::white);
palette.setColor(QPalette::ToolTipText,Qt::white);
palette.setColor(QPalette::Text,Qt::white);
palette.setColor(QPalette::Disabled,QPalette::Text,QColor(127,127,127));
palette.setColor(QPalette::Dark,QColor(35,35,35));
palette.setColor(QPalette::Shadow,QColor(20,20,20));
palette.setColor(QPalette::Button,QColor(53,53,53));
palette.setColor(QPalette::ButtonText,Qt::white);
palette.setColor(QPalette::Disabled,QPalette::ButtonText,QColor(127,127,127));
palette.setColor(QPalette::BrightText,Qt::red);
palette.setColor(QPalette::Link,QColor(42,130,218));
palette.setColor(QPalette::Highlight,QColor(42,130,218));
palette.setColor(QPalette::Disabled,QPalette::Highlight,QColor(80,80,80));
palette.setColor(QPalette::HighlightedText,Qt::white);
palette.setColor(QPalette::Disabled,QPalette::HighlightedText,QColor(127,127,127));
QApplication::setPalette(palette);
}
}

void MainWindow::setData(const QString &data, const QPersistentModelIndex &index, const int &role)
{
// const_cast here is ok, since we need to set data in a correct model, and
Expand Down
4 changes: 4 additions & 0 deletions qrgui/mainWindow/mainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ private slots:
void switchToTab(int index);
int getTabIndex(const QModelIndex &index);

bool windowsDarkThemeAvailiable();
bool windowsIsInDarkTheme();
void initPalette();

void initGridProperties();
void clickErrorListWidget();

Expand Down
2 changes: 1 addition & 1 deletion qrtranslations/fr/plugins/robots/twoDModel_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@
<context>
<name>twoDModel::view::TwoDModelWidget</name>
<message>
<location filename="../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="+323"/>
<location filename="../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="+329"/>
<source>Warning</source>
<translation>Attention</translation>
</message>
Expand Down
2 changes: 1 addition & 1 deletion qrtranslations/fr/qrgui_editor_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<context>
<name>qReal::gui::editor::EdgeElement</name>
<message>
<location filename="../../qrgui/editor/edgeElement.cpp" line="+61"/>
<location filename="../../qrgui/editor/edgeElement.cpp" line="+62"/>
<source>Reverse</source>
<translation type="unfinished">Retourner</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions qrtranslations/fr/qrgui_mainWindow_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
<context>
<name>qReal::MainWindow</name>
<message>
<location filename="../../qrgui/mainWindow/mainWindow.cpp" line="+620"/>
<location filename="../../qrgui/mainWindow/mainWindow.cpp" line="+622"/>
<source>Could not save file, try to save it to another place</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -729,7 +729,7 @@ WARNING: The settings will be restored after application restart</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+673"/>
<location line="+725"/>
<location line="+11"/>
<source>Error</source>
<translation>Erreur</translation>
Expand Down
2 changes: 1 addition & 1 deletion qrtranslations/fr/qrutils_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<translation>Division entière par zéro</translation>
</message>
<message>
<location filename="../../qrutils/graphicsUtils/abstractItem.cpp" line="+594"/>
<location filename="../../qrutils/graphicsUtils/abstractItem.cpp" line="+595"/>
<source>Remove</source>
<translation>Supprimer</translation>
</message>
Expand Down
2 changes: 1 addition & 1 deletion qrtranslations/ru/plugins/robots/twoDModel_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@
<context>
<name>twoDModel::view::TwoDModelWidget</name>
<message>
<location filename="../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="+323"/>
<location filename="../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="+329"/>
<source>Warning</source>
<translation>Предупреждение</translation>
</message>
Expand Down
2 changes: 1 addition & 1 deletion qrtranslations/ru/qrgui_editor_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
<context>
<name>qReal::gui::editor::EdgeElement</name>
<message>
<location filename="../../qrgui/editor/edgeElement.cpp" line="+61"/>
<location filename="../../qrgui/editor/edgeElement.cpp" line="+62"/>
<source>Reverse</source>
<translation>Развернуть</translation>
</message>
Expand Down
6 changes: 3 additions & 3 deletions qrtranslations/ru/qrgui_mainWindow_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@
<translation type="vanished">О QReal</translation>
</message>
<message>
<location filename="../../qrgui/mainWindow/mainWindow.cpp" line="+869"/>
<location filename="../../qrgui/mainWindow/mainWindow.cpp" line="+923"/>
<location line="+11"/>
<source>Error</source>
<translation>Ошибка</translation>
Expand Down Expand Up @@ -788,7 +788,7 @@
<translation>Создать диаграмму</translation>
</message>
<message>
<location line="-1047"/>
<location line="-1099"/>
<source>Restore default settings</source>
<translation>Восстановить настройки по-умолчанию</translation>
</message>
Expand All @@ -807,7 +807,7 @@ WARNING: The settings will be restored after application restart</source>
<translation>Не удалось сохранить файл, попробуйте сохранить его в другое место</translation>
</message>
<message>
<location line="+630"/>
<location line="+682"/>
<source>Undo</source>
<translation>Отменить</translation>
</message>
Expand Down
2 changes: 1 addition & 1 deletion qrtranslations/ru/qrutils_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<translation>Целичисленное деление на ноль</translation>
</message>
<message>
<location filename="../../qrutils/graphicsUtils/abstractItem.cpp" line="+594"/>
<location filename="../../qrutils/graphicsUtils/abstractItem.cpp" line="+595"/>
<source>Remove</source>
<translation>Удалить</translation>
</message>
Expand Down
1 change: 1 addition & 0 deletions qrutils/graphicsUtils/abstractItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <QtWidgets/QGraphicsScene>
#include <QtWidgets/QStyleOptionGraphicsItem>
#include <QtWidgets/QGraphicsSceneMouseEvent>
#include <QApplication>

using namespace graphicsUtils;

Expand Down