Commit 9bf1d526 authored by Tobias Hunger's avatar Tobias Hunger

Add option to override the UI color

 * Add -color option to core plugin which will override
   the base UI color for that session.

Reviewed-by: thorbjorn
parent a37592a1
......@@ -12,4 +12,7 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
</license>
<description>The core plugin for the Qt IDE.</description>
<url>http://qt.nokia.com</url>
<argumentList>
<argument name="-color" parameter="color">Override selected UI color</argument>
</argumentList>
</plugin>
......@@ -37,6 +37,7 @@
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QtPlugin>
#include <QtCore/QDebug>
using namespace Core::Internal;
......@@ -58,9 +59,20 @@ CorePlugin::~CorePlugin()
delete m_mainWindow;
}
void CorePlugin::parseArguments(const QStringList &arguments)
{
for (int i = 0; i < arguments.size() - 1; i++) {
if (arguments.at(i) == QLatin1String("-color")) {
const QString colorcode(arguments.at(i + 1));
m_mainWindow->setOverrideColor(QColor(colorcode));
i++; // skip the argument
}
}
}
bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
parseArguments(arguments);
const bool success = m_mainWindow->init(errorMessage);
if (success) {
EditorManager *editorManager = m_mainWindow->editorManager();
......
......@@ -54,6 +54,8 @@ public slots:
void remoteArgument(const QString&);
private:
void parseArguments(const QStringList & arguments);
MainWindow *m_mainWindow;
EditMode *m_editMode;
};
......
......@@ -228,6 +228,11 @@ void MainWindow::setSuppressNavigationWidget(bool suppress)
m_navigationWidget->setSuppressed(suppress);
}
void MainWindow::setOverrideColor(const QColor &color)
{
m_overrideColor = color;
}
MainWindow::~MainWindow()
{
hide();
......@@ -1103,7 +1108,10 @@ void MainWindow::readSettings()
{
m_settings->beginGroup(QLatin1String(settingsGroup));
Utils::StyleHelper::setBaseColor(m_settings->value(QLatin1String(colorKey)).value<QColor>());
if (m_overrideColor.isValid())
Utils::StyleHelper::setBaseColor(m_overrideColor);
else
Utils::StyleHelper::setBaseColor(m_settings->value(QLatin1String(colorKey)).value<QColor>());
const QVariant geom = m_settings->value(QLatin1String(geometryKey));
if (geom.isValid()) {
......@@ -1126,7 +1134,8 @@ void MainWindow::writeSettings()
{
m_settings->beginGroup(QLatin1String(settingsGroup));
m_settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::baseColor());
if (!(m_overrideColor.isValid() && Utils::StyleHelper::baseColor() == m_overrideColor))
m_settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::baseColor());
if (windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) {
m_settings->setValue(QLatin1String(maxKey), (bool) (windowState() & Qt::WindowMaximized));
......
......@@ -35,6 +35,7 @@
#include "eventfilteringmainwindow.h"
#include <QtCore/QMap>
#include <QtGui/QColor>
QT_BEGIN_NAMESPACE
class QSettings;
......@@ -121,6 +122,8 @@ public:
void setSuppressNavigationWidget(bool suppress);
void setOverrideColor(const QColor &color);
signals:
void windowActivated();
......@@ -219,6 +222,7 @@ private:
#endif
QToolButton *m_toggleSideBarButton;
QColor m_overrideColor;
};
} // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment