ui: Moved color scheme selection to preferences
* removed 'Switch Color Scheme' action from View menu * added dropdown with all fetched color schemes to preferences bug id = 114
This commit is contained in:
+12
-1
@@ -71,7 +71,12 @@ void Application::loadSettings()
|
|||||||
{
|
{
|
||||||
ApplicationSettings::getInstance()->load(FilePath(UserPaths::getAppSettingsPath()));
|
ApplicationSettings::getInstance()->load(FilePath(UserPaths::getAppSettingsPath()));
|
||||||
|
|
||||||
ColorScheme::getInstance()->load(ApplicationSettings::getInstance()->getColorSchemePath());
|
loadStyle(ApplicationSettings::getInstance()->getColorSchemePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::loadStyle(const FilePath& colorSchemePath)
|
||||||
|
{
|
||||||
|
ColorScheme::getInstance()->load(colorSchemePath);
|
||||||
GraphViewStyle::loadStyleSettings();
|
GraphViewStyle::loadStyleSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,6 +328,12 @@ void Application::handleMessage(MessageRefresh* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::handleMessage(MessageSwitchColorScheme* message)
|
||||||
|
{
|
||||||
|
loadStyle(message->colorSchemePath);
|
||||||
|
m_componentManager->refreshViews();
|
||||||
|
}
|
||||||
|
|
||||||
void Application::startMessagingAndScheduling()
|
void Application::startMessagingAndScheduling()
|
||||||
{
|
{
|
||||||
TaskScheduler::getInstance()->startSchedulerLoopThreaded();
|
TaskScheduler::getInstance()->startSchedulerLoopThreaded();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||||
#include "utility/messaging/type/MessageLoadProject.h"
|
#include "utility/messaging/type/MessageLoadProject.h"
|
||||||
#include "utility/messaging/type/MessageRefresh.h"
|
#include "utility/messaging/type/MessageRefresh.h"
|
||||||
|
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||||
|
|
||||||
class IDECommunicationController;
|
class IDECommunicationController;
|
||||||
class NetworkFactory;
|
class NetworkFactory;
|
||||||
@@ -23,11 +24,13 @@ class Application
|
|||||||
, public MessageListener<MessageFinishedParsing>
|
, public MessageListener<MessageFinishedParsing>
|
||||||
, public MessageListener<MessageLoadProject>
|
, public MessageListener<MessageLoadProject>
|
||||||
, public MessageListener<MessageRefresh>
|
, public MessageListener<MessageRefresh>
|
||||||
|
, public MessageListener<MessageSwitchColorScheme>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<Application> create(const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory);
|
static std::shared_ptr<Application> create(const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory);
|
||||||
static std::shared_ptr<Application> create(const Version& version);
|
static std::shared_ptr<Application> create(const Version& version);
|
||||||
static void loadSettings();
|
static void loadSettings();
|
||||||
|
static void loadStyle(const FilePath& colorSchemePath);
|
||||||
|
|
||||||
~Application();
|
~Application();
|
||||||
|
|
||||||
@@ -43,6 +46,7 @@ private:
|
|||||||
virtual void handleMessage(MessageFinishedParsing* message);
|
virtual void handleMessage(MessageFinishedParsing* message);
|
||||||
virtual void handleMessage(MessageLoadProject* message);
|
virtual void handleMessage(MessageLoadProject* message);
|
||||||
virtual void handleMessage(MessageRefresh* message);
|
virtual void handleMessage(MessageRefresh* message);
|
||||||
|
virtual void handleMessage(MessageSwitchColorScheme* message);
|
||||||
|
|
||||||
void startMessagingAndScheduling();
|
void startMessagingAndScheduling();
|
||||||
|
|
||||||
|
|||||||
@@ -196,15 +196,6 @@ void FeatureController::handleMessage(MessageResetZoom* message)
|
|||||||
MessageStatus("Zoom: 100%").dispatch();
|
MessageStatus("Zoom: 100%").dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeatureController::handleMessage(MessageSwitchColorScheme* message)
|
|
||||||
{
|
|
||||||
ApplicationSettings* settings = ApplicationSettings::getInstance().get();
|
|
||||||
settings->setColorSchemePath(message->colorSchemeFilePath);
|
|
||||||
settings->save();
|
|
||||||
|
|
||||||
MessageRefresh().refreshUiOnly().dispatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FeatureController::handleMessage(MessageZoom* message)
|
void FeatureController::handleMessage(MessageZoom* message)
|
||||||
{
|
{
|
||||||
bool zoomIn = message->zoomIn;
|
bool zoomIn = message->zoomIn;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "utility/messaging/type/MessageActivateTokenLocations.h"
|
#include "utility/messaging/type/MessageActivateTokenLocations.h"
|
||||||
#include "utility/messaging/type/MessageResetZoom.h"
|
#include "utility/messaging/type/MessageResetZoom.h"
|
||||||
#include "utility/messaging/type/MessageSearch.h"
|
#include "utility/messaging/type/MessageSearch.h"
|
||||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
|
||||||
#include "utility/messaging/type/MessageZoom.h"
|
#include "utility/messaging/type/MessageZoom.h"
|
||||||
|
|
||||||
class StorageAccess;
|
class StorageAccess;
|
||||||
@@ -27,7 +26,6 @@ class FeatureController
|
|||||||
, public MessageListener<MessageActivateTokenLocations>
|
, public MessageListener<MessageActivateTokenLocations>
|
||||||
, public MessageListener<MessageResetZoom>
|
, public MessageListener<MessageResetZoom>
|
||||||
, public MessageListener<MessageSearch>
|
, public MessageListener<MessageSearch>
|
||||||
, public MessageListener<MessageSwitchColorScheme>
|
|
||||||
, public MessageListener<MessageZoom>
|
, public MessageListener<MessageZoom>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -44,7 +42,6 @@ private:
|
|||||||
virtual void handleMessage(MessageActivateTokenIds* message);
|
virtual void handleMessage(MessageActivateTokenIds* message);
|
||||||
virtual void handleMessage(MessageActivateTokenLocations* message);
|
virtual void handleMessage(MessageActivateTokenLocations* message);
|
||||||
virtual void handleMessage(MessageResetZoom* message);
|
virtual void handleMessage(MessageResetZoom* message);
|
||||||
virtual void handleMessage(MessageSwitchColorScheme* message);
|
|
||||||
virtual void handleMessage(MessageZoom* message);
|
virtual void handleMessage(MessageZoom* message);
|
||||||
|
|
||||||
StorageAccess* m_storageAccess;
|
StorageAccess* m_storageAccess;
|
||||||
|
|||||||
@@ -95,12 +95,12 @@ void ApplicationSettings::setFontSize(int fontSize)
|
|||||||
setValue<int>("application/font_size", fontSize);
|
setValue<int>("application/font_size", fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ApplicationSettings::getColorSchemePath() const
|
FilePath ApplicationSettings::getColorSchemePath() const
|
||||||
{
|
{
|
||||||
std::string defaultPath = ResourcePaths::getColorSchemesPath() + "bright.xml";
|
FilePath defaultPath(ResourcePaths::getColorSchemesPath() + "bright.xml");
|
||||||
std::string path = getValue<std::string>("application/color_scheme", defaultPath);
|
FilePath path(getValue<std::string>("application/color_scheme", defaultPath.str()));
|
||||||
|
|
||||||
if (path != defaultPath && !FilePath(path).exists())
|
if (path != defaultPath && !path.exists())
|
||||||
{
|
{
|
||||||
return defaultPath;
|
return defaultPath;
|
||||||
}
|
}
|
||||||
@@ -108,9 +108,9 @@ std::string ApplicationSettings::getColorSchemePath() const
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationSettings::setColorSchemePath(const std::string& colorSchemePath)
|
void ApplicationSettings::setColorSchemePath(const FilePath& colorSchemePath)
|
||||||
{
|
{
|
||||||
setValue<std::string>("application/color_scheme", colorSchemePath);
|
setValue<std::string>("application/color_scheme", colorSchemePath.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
int ApplicationSettings::getFontSizeMax() const
|
int ApplicationSettings::getFontSizeMax() const
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public:
|
|||||||
int getFontSize() const;
|
int getFontSize() const;
|
||||||
void setFontSize(int fontSize);
|
void setFontSize(int fontSize);
|
||||||
|
|
||||||
std::string getColorSchemePath() const;
|
FilePath getColorSchemePath() const;
|
||||||
void setColorSchemePath(const std::string& colorSchemePath);
|
void setColorSchemePath(const FilePath& colorSchemePath);
|
||||||
|
|
||||||
int getFontSizeMax() const;
|
int getFontSizeMax() const;
|
||||||
void setFontSizeMax(const int fontSizeMax);
|
void setFontSizeMax(const int fontSizeMax);
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ class MessageSwitchColorScheme
|
|||||||
: public Message<MessageSwitchColorScheme>
|
: public Message<MessageSwitchColorScheme>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MessageSwitchColorScheme(const std::string& filePath)
|
MessageSwitchColorScheme(const FilePath& filePath)
|
||||||
: colorSchemeFilePath(filePath)
|
: colorSchemePath(filePath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,10 +19,10 @@ public:
|
|||||||
|
|
||||||
virtual void print(std::ostream& os) const
|
virtual void print(std::ostream& os) const
|
||||||
{
|
{
|
||||||
os << colorSchemeFilePath;
|
os << colorSchemePath.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string colorSchemeFilePath;
|
const FilePath colorSchemePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MESSAGE_SWITCH_COLOR_SCHEME_H
|
#endif // MESSAGE_SWITCH_COLOR_SCHEME_H
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include "utility/messaging/type/MessageRefresh.h"
|
#include "utility/messaging/type/MessageRefresh.h"
|
||||||
#include "utility/messaging/type/MessageResetZoom.h"
|
#include "utility/messaging/type/MessageResetZoom.h"
|
||||||
#include "utility/messaging/type/MessageSearch.h"
|
#include "utility/messaging/type/MessageSearch.h"
|
||||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
|
||||||
#include "utility/messaging/type/MessageUndo.h"
|
#include "utility/messaging/type/MessageUndo.h"
|
||||||
#include "utility/messaging/type/MessageWindowFocus.h"
|
#include "utility/messaging/type/MessageWindowFocus.h"
|
||||||
#include "utility/messaging/type/MessageZoom.h"
|
#include "utility/messaging/type/MessageZoom.h"
|
||||||
@@ -474,16 +473,6 @@ void QtMainWindow::resetZoom()
|
|||||||
MessageResetZoom().dispatch();
|
MessageResetZoom().dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtMainWindow::switchColorScheme()
|
|
||||||
{
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), (ResourcePaths::getColorSchemesPath()).c_str(), "XML Files (*.xml)");
|
|
||||||
|
|
||||||
if (!fileName.isEmpty())
|
|
||||||
{
|
|
||||||
MessageSwitchColorScheme(fileName.toStdString()).dispatch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMainWindow::toggleView(View* view, bool fromMenu)
|
void QtMainWindow::toggleView(View* view, bool fromMenu)
|
||||||
{
|
{
|
||||||
DockWidget* dock = getDockWidgetForView(view);
|
DockWidget* dock = getDockWidgetForView(view);
|
||||||
@@ -624,10 +613,6 @@ void QtMainWindow::setupViewMenu()
|
|||||||
menu->addAction(tr("Smaller font"), this, SLOT(zoomOut()), QKeySequence::ZoomOut);
|
menu->addAction(tr("Smaller font"), this, SLOT(zoomOut()), QKeySequence::ZoomOut);
|
||||||
menu->addAction(tr("Reset font size"), this, SLOT(resetZoom()), QKeySequence(Qt::CTRL + Qt::Key_0));
|
menu->addAction(tr("Reset font size"), this, SLOT(resetZoom()), QKeySequence(Qt::CTRL + Qt::Key_0));
|
||||||
|
|
||||||
menu->addSeparator();
|
|
||||||
|
|
||||||
menu->addAction(tr("Switch Color Scheme..."), this, SLOT(switchColorScheme()));
|
|
||||||
|
|
||||||
m_viewMenu = menu;
|
m_viewMenu = menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ public slots:
|
|||||||
void zoomIn();
|
void zoomIn();
|
||||||
void zoomOut();
|
void zoomOut();
|
||||||
void resetZoom();
|
void resetZoom();
|
||||||
void switchColorScheme();
|
|
||||||
|
|
||||||
void toggleView(View* view, bool fromMenu);
|
void toggleView(View* view, bool fromMenu);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,30 @@
|
|||||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h"
|
#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h"
|
||||||
|
|
||||||
#include "settings/ApplicationSettings.h"
|
#include "settings/ApplicationSettings.h"
|
||||||
|
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||||
|
#include "utility/file/FileSystem.h"
|
||||||
|
#include "utility/ResourcePaths.h"
|
||||||
|
|
||||||
QtProjectWizzardContentPreferences::QtProjectWizzardContentPreferences(
|
QtProjectWizzardContentPreferences::QtProjectWizzardContentPreferences(
|
||||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||||
)
|
)
|
||||||
: QtProjectWizzardContent(settings, window)
|
: QtProjectWizzardContent(settings, window)
|
||||||
|
, m_oldColorSchemeIndex(-1)
|
||||||
{
|
{
|
||||||
|
std::vector<std::string> colorSchemePaths =
|
||||||
|
FileSystem::getFileNamesFromDirectory(ResourcePaths::getColorSchemesPath(), std::vector<std::string>(1, ".xml"));
|
||||||
|
for (const std::string& colorScheme : colorSchemePaths)
|
||||||
|
{
|
||||||
|
m_colorSchemePaths.push_back(FilePath(colorScheme));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtProjectWizzardContentPreferences::~QtProjectWizzardContentPreferences()
|
||||||
|
{
|
||||||
|
if (m_oldColorSchemeIndex != -1)
|
||||||
|
{
|
||||||
|
colorSchemeChanged(m_oldColorSchemeIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtProjectWizzardContentPreferences::populateWindow(QGridLayout* layout)
|
void QtProjectWizzardContentPreferences::populateWindow(QGridLayout* layout)
|
||||||
@@ -24,41 +42,49 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
|
|||||||
row++;
|
row++;
|
||||||
|
|
||||||
// font face
|
// font face
|
||||||
QLabel* fontLabel = createFormLabel("Font face");
|
|
||||||
m_fontFace = new QLineEdit();
|
m_fontFace = new QLineEdit();
|
||||||
m_fontFace->setObjectName("name");
|
m_fontFace->setObjectName("name");
|
||||||
m_fontFace->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
m_fontFace->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||||
|
|
||||||
layout->addWidget(fontLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
layout->addWidget(createFormLabel("Font face"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||||
layout->addWidget(m_fontFace, row, QtProjectWizzardWindow::BACK_COL);
|
layout->addWidget(m_fontFace, row, QtProjectWizzardWindow::BACK_COL);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
// font size
|
// font size
|
||||||
QLabel* sizeLabel = createFormLabel("Font size");
|
|
||||||
|
|
||||||
m_fontSize = new QComboBox();
|
m_fontSize = new QComboBox();
|
||||||
for (int i = appSettings->getFontSizeMin(); i <= appSettings->getFontSizeMax(); i++)
|
for (int i = appSettings->getFontSizeMin(); i <= appSettings->getFontSizeMax(); i++)
|
||||||
{
|
{
|
||||||
m_fontSize->insertItem(i, QString::number(i));
|
m_fontSize->insertItem(i, QString::number(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->addWidget(sizeLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
layout->addWidget(createFormLabel("Font size"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||||
layout->addWidget(m_fontSize, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
layout->addWidget(m_fontSize, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
// tab width
|
// tab width
|
||||||
QLabel* tabLabel = createFormLabel("Tab width");
|
|
||||||
|
|
||||||
m_tabWidth = new QComboBox();
|
m_tabWidth = new QComboBox();
|
||||||
for (int i = 1; i < 17; i++)
|
for (int i = 1; i < 17; i++)
|
||||||
{
|
{
|
||||||
m_tabWidth->insertItem(i, QString::number(i));
|
m_tabWidth->insertItem(i, QString::number(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->addWidget(tabLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
layout->addWidget(createFormLabel("Tab width"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||||
layout->addWidget(m_tabWidth, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
layout->addWidget(m_tabWidth, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
|
// color scheme
|
||||||
|
m_colorSchemes = new QComboBox();
|
||||||
|
for (size_t i = 0; i < m_colorSchemePaths.size(); i++)
|
||||||
|
{
|
||||||
|
m_colorSchemes->insertItem(i, m_colorSchemePaths[i].withoutExtension().fileName().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(m_colorSchemes, SIGNAL(activated(int)), this, SLOT(colorSchemeChanged(int)));
|
||||||
|
|
||||||
|
layout->addWidget(createFormLabel("Color scheme"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||||
|
layout->addWidget(m_colorSchemes, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||||
|
row++;
|
||||||
|
|
||||||
layout->setRowMinimumHeight(row++, 20);
|
layout->setRowMinimumHeight(row++, 20);
|
||||||
|
|
||||||
|
|
||||||
@@ -67,15 +93,13 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
|
|||||||
row++;
|
row++;
|
||||||
|
|
||||||
// indexer threads
|
// indexer threads
|
||||||
QLabel* threadsLabel = createFormLabel("Indexer threads");
|
|
||||||
|
|
||||||
m_threads = new QComboBox();
|
m_threads = new QComboBox();
|
||||||
for (int i = 1; i <= 24; i++)
|
for (int i = 1; i <= 24; i++)
|
||||||
{
|
{
|
||||||
m_threads->insertItem(i, QString::number(i));
|
m_threads->insertItem(i, QString::number(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->addWidget(threadsLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
layout->addWidget(createFormLabel("Indexer threads"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||||
layout->addWidget(m_threads, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
layout->addWidget(m_threads, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||||
|
|
||||||
addHelpButton(
|
addHelpButton(
|
||||||
@@ -86,11 +110,9 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
|
|||||||
row++;
|
row++;
|
||||||
|
|
||||||
// ignore non-fatal errors in non-indexed files
|
// ignore non-fatal errors in non-indexed files
|
||||||
QLabel* errorsLabel = createFormLabel("Non-Fatal Errors");
|
|
||||||
|
|
||||||
m_fatalErrors = new QCheckBox("Display non-fatal errors in unindexed files", this);
|
m_fatalErrors = new QCheckBox("Display non-fatal errors in unindexed files", this);
|
||||||
|
|
||||||
layout->addWidget(errorsLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
layout->addWidget(createFormLabel("Non-Fatal Errors"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||||
layout->addWidget(m_fatalErrors, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
layout->addWidget(m_fatalErrors, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||||
|
|
||||||
addHelpButton(
|
addHelpButton(
|
||||||
@@ -110,6 +132,17 @@ void QtProjectWizzardContentPreferences::load()
|
|||||||
m_fontSize->setCurrentIndex(appSettings->getFontSize() - appSettings->getFontSizeMin());
|
m_fontSize->setCurrentIndex(appSettings->getFontSize() - appSettings->getFontSizeMin());
|
||||||
m_tabWidth->setCurrentIndex(appSettings->getCodeTabWidth() - 1);
|
m_tabWidth->setCurrentIndex(appSettings->getCodeTabWidth() - 1);
|
||||||
|
|
||||||
|
FilePath colorSchemePath = appSettings->getColorSchemePath();
|
||||||
|
for (size_t i = 0; i < m_colorSchemePaths.size(); i++)
|
||||||
|
{
|
||||||
|
if (colorSchemePath == m_colorSchemePaths[i])
|
||||||
|
{
|
||||||
|
m_colorSchemes->setCurrentIndex(i);
|
||||||
|
m_oldColorSchemeIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_threads->setCurrentIndex(appSettings->getIndexerThreadCount() - 1);
|
m_threads->setCurrentIndex(appSettings->getIndexerThreadCount() - 1);
|
||||||
m_fatalErrors->setChecked(appSettings->getShowExternalNonFatalErrors());
|
m_fatalErrors->setChecked(appSettings->getShowExternalNonFatalErrors());
|
||||||
}
|
}
|
||||||
@@ -123,6 +156,9 @@ void QtProjectWizzardContentPreferences::save()
|
|||||||
appSettings->setFontSize(m_fontSize->currentIndex() + appSettings->getFontSizeMin());
|
appSettings->setFontSize(m_fontSize->currentIndex() + appSettings->getFontSizeMin());
|
||||||
appSettings->setCodeTabWidth(m_tabWidth->currentIndex() + 1);
|
appSettings->setCodeTabWidth(m_tabWidth->currentIndex() + 1);
|
||||||
|
|
||||||
|
appSettings->setColorSchemePath(m_colorSchemePaths[m_colorSchemes->currentIndex()]);
|
||||||
|
m_oldColorSchemeIndex = -1;
|
||||||
|
|
||||||
appSettings->setIndexerThreadCount(m_threads->currentIndex() + 1);
|
appSettings->setIndexerThreadCount(m_threads->currentIndex() + 1);
|
||||||
appSettings->setShowExternalNonFatalErrors(m_fatalErrors->isChecked());
|
appSettings->setShowExternalNonFatalErrors(m_fatalErrors->isChecked());
|
||||||
}
|
}
|
||||||
@@ -131,3 +167,8 @@ bool QtProjectWizzardContentPreferences::check()
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtProjectWizzardContentPreferences::colorSchemeChanged(int index)
|
||||||
|
{
|
||||||
|
MessageSwitchColorScheme(m_colorSchemePaths[index]).dispatch();
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class QtProjectWizzardContentPreferences
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QtProjectWizzardContentPreferences(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
QtProjectWizzardContentPreferences(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||||
|
~QtProjectWizzardContentPreferences();
|
||||||
|
|
||||||
// QtProjectWizzardContent implementation
|
// QtProjectWizzardContent implementation
|
||||||
virtual void populateWindow(QGridLayout* layout) override;
|
virtual void populateWindow(QGridLayout* layout) override;
|
||||||
@@ -23,12 +24,20 @@ public:
|
|||||||
virtual void save() override;
|
virtual void save() override;
|
||||||
virtual bool check() override;
|
virtual bool check() override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void colorSchemeChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLineEdit* m_fontFace;
|
QLineEdit* m_fontFace;
|
||||||
QComboBox* m_fontSize;
|
QComboBox* m_fontSize;
|
||||||
QComboBox* m_tabWidth;
|
QComboBox* m_tabWidth;
|
||||||
|
QComboBox* m_colorSchemes;
|
||||||
|
|
||||||
QComboBox* m_threads;
|
QComboBox* m_threads;
|
||||||
QCheckBox* m_fatalErrors;
|
QCheckBox* m_fatalErrors;
|
||||||
|
|
||||||
|
std::vector<FilePath> m_colorSchemePaths;
|
||||||
|
int m_oldColorSchemeIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H
|
#endif // QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H
|
||||||
|
|||||||
Reference in New Issue
Block a user