forked from qt-creator/qt-creator
Remove dependencies on Plastique and Cleanlooks
We want to move these styles out of the library so we should not depend on them in creator. Change-Id: I5326285d880c5e85d8d5ccdeca36fba30cf53ae0 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -109,6 +109,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QStyleFactory>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
@@ -188,12 +189,16 @@ MainWindow::MainWindow() :
|
|||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||||
if (baseName == QLatin1String("windows")) {
|
if (baseName == QLatin1String("windows")) {
|
||||||
// Sometimes we get the standard windows 95 style as a fallback
|
// Sometimes we get the standard windows 95 style as a fallback
|
||||||
// e.g. if we are running on a KDE4 desktop
|
if (QStyleFactory::keys().contains("Fusion"))
|
||||||
QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION");
|
baseName = QLatin1String("fusion"); // Qt5
|
||||||
if (desktopEnvironment == "kde")
|
else { // Qt4
|
||||||
baseName = QLatin1String("plastique");
|
// e.g. if we are running on a KDE4 desktop
|
||||||
else
|
QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION");
|
||||||
baseName = QLatin1String("cleanlooks");
|
if (desktopEnvironment == "kde")
|
||||||
|
baseName = QLatin1String("plastique");
|
||||||
|
else
|
||||||
|
baseName = QLatin1String("cleanlooks");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
qApp->setStyle(new ManhattanStyle(baseName));
|
qApp->setStyle(new ManhattanStyle(baseName));
|
||||||
|
@@ -44,48 +44,43 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGraphicsOpacityEffect>
|
#include <QGraphicsOpacityEffect>
|
||||||
#include <QCleanlooksStyle>
|
#include <QWindowsStyle>
|
||||||
#include <QPlastiqueStyle>
|
|
||||||
|
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class CleanLooksSingleton
|
class WindowsStyleSingleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static CleanLooksSingleton* instance();
|
static WindowsStyleSingleton* instance();
|
||||||
QStyle* style() {return &m_style; };
|
QStyle* style() {return &m_style; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static CleanLooksSingleton *m_instance;
|
static WindowsStyleSingleton *m_instance;
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
QWindowsStyle m_style;
|
||||||
QPlastiqueStyle m_style;
|
|
||||||
#else
|
|
||||||
QCleanlooksStyle m_style;
|
|
||||||
#endif //Q_OS_MAC
|
|
||||||
|
|
||||||
CleanLooksSingleton() {}
|
WindowsStyleSingleton() {}
|
||||||
CleanLooksSingleton( const CleanLooksSingleton& );
|
WindowsStyleSingleton( const WindowsStyleSingleton& );
|
||||||
|
|
||||||
class CleanLooksWatcher {
|
class WindowsWatcher {
|
||||||
public: ~CleanLooksWatcher() {
|
public: ~WindowsWatcher() {
|
||||||
if( CleanLooksSingleton::m_instance != 0 )
|
if ( WindowsStyleSingleton::m_instance != 0 )
|
||||||
delete CleanLooksSingleton::m_instance;
|
delete WindowsStyleSingleton::m_instance;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
friend class CleanLooksWatcher;
|
friend class WindowsWatcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
CleanLooksSingleton* CleanLooksSingleton::m_instance = 0;
|
WindowsStyleSingleton* WindowsStyleSingleton::m_instance = 0;
|
||||||
|
|
||||||
CleanLooksSingleton* CleanLooksSingleton::instance()
|
WindowsStyleSingleton* WindowsStyleSingleton::instance()
|
||||||
{
|
{
|
||||||
static CleanLooksWatcher w;
|
static WindowsWatcher w;
|
||||||
if( m_instance == 0 )
|
if( m_instance == 0 )
|
||||||
m_instance = new CleanLooksSingleton();
|
m_instance = new WindowsStyleSingleton();
|
||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +165,7 @@ public:
|
|||||||
filter->setDuiTarget(this);
|
filter->setDuiTarget(this);
|
||||||
m_mouseOver = false;
|
m_mouseOver = false;
|
||||||
q->installEventFilter(filter);
|
q->installEventFilter(filter);
|
||||||
q->setStyle(CleanLooksSingleton::instance()->style());
|
q->setStyle(WindowsStyleSingleton::instance()->style());
|
||||||
Q_ASSERT(q);
|
Q_ASSERT(q);
|
||||||
}
|
}
|
||||||
virtual ~QWidgetDeclarativeUI() {
|
virtual ~QWidgetDeclarativeUI() {
|
||||||
|
Reference in New Issue
Block a user