diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 05cb6ca8..929bcdcc 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -128,6 +128,7 @@ SOURCES += \ widgets/headercompletionpopup.cpp \ widgets/issuestable.cpp \ widgets/labelwithmenu.cpp \ + widgets/lightfusionstyle.cpp \ widgets/macroinfomodel.cpp \ widgets/newprojectdialog.cpp \ widgets/ojproblempropertywidget.cpp \ @@ -254,6 +255,7 @@ HEADERS += \ widgets/headercompletionpopup.h \ widgets/issuestable.h \ widgets/labelwithmenu.h \ + widgets/lightfusionstyle.h \ widgets/macroinfomodel.h \ widgets/newprojectdialog.h \ widgets/ojproblempropertywidget.h \ diff --git a/RedPandaIDE/icons.qrc b/RedPandaIDE/icons.qrc index 8dcecf90..a2d225d4 100644 --- a/RedPandaIDE/icons.qrc +++ b/RedPandaIDE/icons.qrc @@ -490,5 +490,7 @@ images/classparser/var_private.svg images/classparser/var_protected.svg images/classparser/var_public.svg + images/newlook/01File-01New.svg + images/newlook/01File-02Open.svg diff --git a/RedPandaIDE/iconsmanager.cpp b/RedPandaIDE/iconsmanager.cpp index 8fddc8a1..a3596110 100644 --- a/RedPandaIDE/iconsmanager.cpp +++ b/RedPandaIDE/iconsmanager.cpp @@ -2,6 +2,7 @@ #include #include +#include IconsManager* pIconsManager; @@ -16,6 +17,7 @@ IconsManager::IconsManager(QObject *parent) : QObject(parent) void IconsManager::updateEditorGuttorIcons(const QString& iconSet,int size) { QString iconFolder = QString(":/icons/images/%1/").arg(iconSet); + qDebug()< + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/images/newlook/01File-02Open.svg b/RedPandaIDE/images/newlook/01File-02Open.svg new file mode 100644 index 00000000..eac41eb9 --- /dev/null +++ b/RedPandaIDE/images/newlook/01File-02Open.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index eb62df03..4fa1277b 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -18,6 +18,7 @@ #include "colorscheme.h" #include "thememanager.h" #include "widgets/darkfusionstyle.h" +#include "widgets/lightfusionstyle.h" #include "problems/problemcasevalidator.h" #include "widgets/ojproblempropertywidget.h" #include "version.h" @@ -286,6 +287,8 @@ MainWindow::MainWindow(QWidget *parent) updateShortcuts(); updateTools(); + + updateEditorSettings(); } MainWindow::~MainWindow() @@ -533,7 +536,7 @@ void MainWindow::applySettings() if (appTheme->isDark()) QApplication::setStyle(new DarkFusionStyle()); else - QApplication::setStyle("fusion"); + QApplication::setStyle(new LightFusionStyle()); qApp->setPalette(appTheme->palette()); //fix for qstatusbar bug mFileEncodingStatus->setPalette(appTheme->palette()); @@ -583,6 +586,7 @@ void MainWindow::applySettings() ui->tabInfos->removeTab(idxProblemSet); } updateDebuggerSettings(); + updateActionIcons(); } void MainWindow::applyUISettings() @@ -1092,6 +1096,19 @@ void MainWindow::updateDebuggerSettings() } +void MainWindow::updateActionIcons() +{ + int size = pointToPixel(pSettings->environment().interfaceFontSize()); + pIconsManager->updateActionIcons("newlook", size); + QSize iconSize(size,size); + ui->toolbarMain->setIconSize(iconSize); + ui->toolbarCode->setIconSize(iconSize); + ui->toolbarCompile->setIconSize(iconSize); + ui->toolbarDebug->setIconSize(iconSize); + ui->actionNew->setIcon(QIcon(*(pIconsManager->getIcon(IconsManager::ACTION_FILE_NEW)))); + ui->actionOpen->setIcon(QIcon(*(pIconsManager->getIcon(IconsManager::ACTION_FILE_OPEN)))); +} + void MainWindow::checkSyntaxInBack(Editor *e) { if (e==nullptr) diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 949ba708..74529d96 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -89,6 +89,7 @@ public: void updateEditorColorSchemes(); void updateCompilerSet(); void updateDebuggerSettings(); + void updateActionIcons(); void checkSyntaxInBack(Editor* e); bool compile(bool rebuild=false); void runExecutable(const QString& exeName, const QString& filename=QString(),RunType runType = RunType::Normal); diff --git a/RedPandaIDE/widgets/darkfusionstyle.cpp b/RedPandaIDE/widgets/darkfusionstyle.cpp index ad65c51e..fee6a28c 100644 --- a/RedPandaIDE/widgets/darkfusionstyle.cpp +++ b/RedPandaIDE/widgets/darkfusionstyle.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "../settings.h" #define BEGIN_STYLE_PIXMAPCACHE(a) \ QRect rect = option->rect; \ @@ -799,6 +800,16 @@ void DarkFusionStyle::drawComplexControl(ComplexControl control, const QStyleOpt QProxyStyle::drawComplexControl(control,option,painter,widget); } +int DarkFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const +{ + switch ( metric ) { + case QStyle::PM_SmallIconSize: + return pointToPixel(pSettings->environment().interfaceFontSize()); + default: + return QProxyStyle::pixelMetric( metric, option, widget ); + } +} + void DarkFusionStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { diff --git a/RedPandaIDE/widgets/darkfusionstyle.h b/RedPandaIDE/widgets/darkfusionstyle.h index 2aa6694d..c749a88f 100644 --- a/RedPandaIDE/widgets/darkfusionstyle.h +++ b/RedPandaIDE/widgets/darkfusionstyle.h @@ -16,11 +16,9 @@ public: const QWidget *widget) const override; QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override; - - // QStyle interface -public: void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const override; + int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const override; }; #endif // DARKFUSIONSTYLE_H diff --git a/RedPandaIDE/widgets/lightfusionstyle.cpp b/RedPandaIDE/widgets/lightfusionstyle.cpp new file mode 100644 index 00000000..9a807bb9 --- /dev/null +++ b/RedPandaIDE/widgets/lightfusionstyle.cpp @@ -0,0 +1,17 @@ +#include "lightfusionstyle.h" +#include "../settings.h" + +LightFusionStyle::LightFusionStyle():QProxyStyle("fusion") +{ + +} + +int LightFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const +{ + switch ( metric ) { + case QStyle::PM_SmallIconSize: + return pointToPixel(pSettings->environment().interfaceFontSize()); + default: + return QProxyStyle::pixelMetric( metric, option, widget ); + } +} diff --git a/RedPandaIDE/widgets/lightfusionstyle.h b/RedPandaIDE/widgets/lightfusionstyle.h new file mode 100644 index 00000000..58f43fc0 --- /dev/null +++ b/RedPandaIDE/widgets/lightfusionstyle.h @@ -0,0 +1,18 @@ +#ifndef LIGHTFUSIONSTYLE_H +#define LIGHTFUSIONSTYLE_H + +#include +#include + +class LightFusionStyle : public QProxyStyle +{ + Q_OBJECT +public: + LightFusionStyle(); + // QStyle interface +public: + int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const override; + +}; + +#endif // LIGHTFUSIONSTYLE_H