/[svn]/qsampler/trunk/src/qsampler.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsampler.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3556 by capela, Thu Aug 15 09:09:21 2019 UTC revision 3648 by capela, Tue Dec 10 10:34:06 2019 UTC
# Line 25  Line 25 
25  #include "qsamplerOptions.h"  #include "qsamplerOptions.h"
26  #include "qsamplerMainForm.h"  #include "qsamplerMainForm.h"
27    
28    #include "qsamplerPaletteForm.h"
29    
30    #include <QDir>
31    
32    #include <QStyleFactory>
33    
34  #include <QLibraryInfo>  #include <QLibraryInfo>
35  #include <QTranslator>  #include <QTranslator>
36  #include <QLocale>  #include <QLocale>
# Line 41  Line 47 
47  #define CONFIG_DATADIR  CONFIG_PREFIX "/share"  #define CONFIG_DATADIR  CONFIG_PREFIX "/share"
48  #endif  #endif
49    
50    #ifndef CONFIG_LIBDIR
51    #if defined(__x86_64__)
52    #define CONFIG_LIBDIR  CONFIG_PREFIX "/lib64"
53    #else
54    #define CONFIG_LIBDIR  CONFIG_PREFIX "/lib"
55    #endif
56    #endif
57    
58    #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
59    #define CONFIG_PLUGINSDIR CONFIG_LIBDIR "/qt4/plugins"
60    #else
61    #define CONFIG_PLUGINSDIR CONFIG_LIBDIR "/qt5/plugins"
62    #endif
63    
64  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
65  #define RELATIVE_LOCALE_DIR "/share/locale"  #define RELATIVE_LOCALE_DIR "/share/locale"
66  #elif defined(__APPLE__)  #elif defined(__APPLE__)
# Line 80  qsamplerApplication::qsamplerApplication Line 100  qsamplerApplication::qsamplerApplication
100          : QApplication(argc, argv),          : QApplication(argc, argv),
101                  m_pQtTranslator(nullptr), m_pMyTranslator(nullptr), m_pWidget(nullptr)                  m_pQtTranslator(nullptr), m_pMyTranslator(nullptr), m_pWidget(nullptr)
102  {  {
103    #if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
104            QApplication::setApplicationName(QSAMPLER_TITLE);
105            QApplication::setApplicationDisplayName(QSAMPLER_TITLE);
106            //      QSAMPLER_TITLE " - " + QObject::tr(QSAMPLER_SUBTITLE));
107    #endif
108          // Load translation support.          // Load translation support.
109          QLocale loc;          QLocale loc;
110          if (loc.language() != QLocale::C) {          if (loc.language() != QLocale::C) {
# Line 458  int main ( int argc, char **argv ) Line 483  int main ( int argc, char **argv )
483          ::signal(SIGBUS,  stacktrace);          ::signal(SIGBUS,  stacktrace);
484  #endif  #endif
485  #endif  #endif
         qsamplerApplication app(argc, argv);  
486  #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)  #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
487          app.setAttribute(Qt::AA_EnableHighDpiScaling);          QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
488  #endif  #endif
489            qsamplerApplication app(argc, argv);
490    
491          #if defined(__APPLE__)  //  Toshi Nagata 20080105          #if defined(__APPLE__)  //  Toshi Nagata 20080105
492          {          {
493                  //  Set the plugin path to @exetutable_path/../plugins                  //  Set the plugin path to @exetutable_path/../plugins
# Line 491  int main ( int argc, char **argv ) Line 517  int main ( int argc, char **argv )
517                  return 2;                  return 2;
518          }          }
519    
520          // Dark themes grayed/disabled color group fix...          // Special custom styles...
521            if (QDir(CONFIG_PLUGINSDIR).exists())
522                    app.addLibraryPath(CONFIG_PLUGINSDIR);
523            if (!options.sCustomStyleTheme.isEmpty())
524                    app.setStyle(QStyleFactory::create(options.sCustomStyleTheme));
525    
526            // Custom color theme (eg. "KXStudio")...
527          QPalette pal(app.palette());          QPalette pal(app.palette());
528          if (pal.base().color().value() < 0x7f) {          if (QSampler::PaletteForm::namedPalette(
529          #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)                          &options.settings(), options.sCustomColorTheme, pal))
                 const QColor& color = pal.window().color();  
                 const int iGroups = int(QPalette::Active | QPalette::Inactive) + 1;  
                 for (int i = 0; i < iGroups; ++i) {  
                         const QPalette::ColorGroup group = QPalette::ColorGroup(i);  
                         pal.setBrush(group, QPalette::Light,    color.lighter(150));  
                         pal.setBrush(group, QPalette::Midlight, color.lighter(120));  
                         pal.setBrush(group, QPalette::Dark,     color.darker(150));  
                         pal.setBrush(group, QPalette::Mid,      color.darker(120));  
                         pal.setBrush(group, QPalette::Shadow,   color.darker(200));  
                 }  
         //      pal.setColor(QPalette::Disabled, QPalette::ButtonText, pal.mid().color());  
         #endif  
                 pal.setColorGroup(QPalette::Disabled,  
                         pal.windowText().color().darker(),  
                         pal.button(),  
                         pal.light(),  
                         pal.dark(),  
                         pal.mid(),  
                         pal.text().color().darker(),  
                         pal.text().color().lighter(),  
                         pal.base(),  
                         pal.window());  
530                  app.setPalette(pal);                  app.setPalette(pal);
         }  
531    
532          // Set default base font...          // Set default base font...
533          if (options.iBaseFontSize > 0)          if (options.iBaseFontSize > 0)

Legend:
Removed from v.3556  
changed lines
  Added in v.3648

  ViewVC Help
Powered by ViewVC