diff --git a/CMakeLists.txt b/CMakeLists.txt index f0ee71a4..cea3bdb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,8 +267,6 @@ set(PROJECT_SOURCES ftshelpers.hh fulltextsearch.cc fulltextsearch.hh - gdappstyle.cc - gdappstyle.hh gddebug.cc gddebug.hh german.cc diff --git a/goldendict.pro b/goldendict.pro index e49d7059..5b16a6e8 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -352,7 +352,6 @@ HEADERS += \ src/common/folding.hh \ src/ftshelpers.hh \ src/fulltextsearch.hh \ - src/gdappstyle.hh \ src/gestures.hh \ src/headwordsmodel.hh \ src/history.hh \ @@ -474,7 +473,6 @@ SOURCES += \ src/common/folding.cc \ src/ftshelpers.cc \ src/fulltextsearch.cc \ - src/gdappstyle.cc \ src/gestures.cc \ src/headwordsmodel.cc \ src/history.cc \ diff --git a/src/gdappstyle.cc b/src/gdappstyle.cc deleted file mode 100644 index 76852705..00000000 --- a/src/gdappstyle.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* This file is (c) 2012 Tvangeste - * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ - -#include "gdappstyle.hh" - -#include "dictionarybar.hh" - -#include -#include - -GdAppStyle::GdAppStyle(QProxyStyle * parent) : QProxyStyle(parent) {} - -int GdAppStyle::pixelMetric ( PixelMetric metric, const QStyleOption * option, const QWidget * widget) const -{ - int defaultVal = QProxyStyle::pixelMetric(metric, option, widget); - - if ( dictionaryBarButton( widget ) ) - { - if ( metric == QStyle::PM_ButtonShiftVertical || metric == QStyle::PM_ButtonShiftHorizontal ) - { - if (option ->state & State_Sunken ) { - return defaultVal; - } - - if ( option ->state & State_On ) { - // No shift for for the checked tool buttons on the dictionary bar, - // that's why the whole thing with QProxyStyle is neded, to achieve this. - return 0; - } - } - } - - // Qt don't upscale icons for high dpi scales - // We limit maximum small icon size to 21 pixel - // (standard icon size for Lingvo dictionaries) - if( metric == QStyle::PM_SmallIconSize ) - return defaultVal < 21 ? defaultVal : 21; - - return defaultVal; -} - -bool GdAppStyle::dictionaryBarButton(const QWidget * widget) const { - if (widget) { - const QWidget * parent = widget->parentWidget(); - if ( parent && - qobject_cast( parent ) && - qobject_cast( widget ) ) - return true; - } - - return false; -} diff --git a/src/gdappstyle.hh b/src/gdappstyle.hh deleted file mode 100644 index 1b3bb9e1..00000000 --- a/src/gdappstyle.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* This file is (c) 2012 Tvangeste - * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ - -#ifndef GDAPPSTYLE_HH -#define GDAPPSTYLE_HH - -#include -#include -#include -#include - -class GdAppStyle : public QProxyStyle -{ - Q_OBJECT - -public: - explicit GdAppStyle(QProxyStyle *style = 0); - virtual int pixelMetric ( PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const; - -signals: - -public slots: - -private: - /// is this widget a tool button on the dictionary bar? - bool dictionaryBarButton(const QWidget * widget) const; - -}; - -#endif // GDAPPSTYLE_HH diff --git a/src/main.cc b/src/main.cc index c364ac0e..7ecb4f93 100644 --- a/src/main.cc +++ b/src/main.cc @@ -3,7 +3,6 @@ #include #include -#include "gdappstyle.hh" #include "mainwindow.hh" #include "config.hh" #include