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()));
|
||||
|
||||
ColorScheme::getInstance()->load(ApplicationSettings::getInstance()->getColorSchemePath());
|
||||
loadStyle(ApplicationSettings::getInstance()->getColorSchemePath());
|
||||
}
|
||||
|
||||
void Application::loadStyle(const FilePath& colorSchemePath)
|
||||
{
|
||||
ColorScheme::getInstance()->load(colorSchemePath);
|
||||
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()
|
||||
{
|
||||
TaskScheduler::getInstance()->startSchedulerLoopThreaded();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||
|
||||
class IDECommunicationController;
|
||||
class NetworkFactory;
|
||||
@@ -23,11 +24,13 @@ class Application
|
||||
, public MessageListener<MessageFinishedParsing>
|
||||
, public MessageListener<MessageLoadProject>
|
||||
, public MessageListener<MessageRefresh>
|
||||
, public MessageListener<MessageSwitchColorScheme>
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<Application> create(const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory);
|
||||
static std::shared_ptr<Application> create(const Version& version);
|
||||
static void loadSettings();
|
||||
static void loadStyle(const FilePath& colorSchemePath);
|
||||
|
||||
~Application();
|
||||
|
||||
@@ -43,6 +46,7 @@ private:
|
||||
virtual void handleMessage(MessageFinishedParsing* message);
|
||||
virtual void handleMessage(MessageLoadProject* message);
|
||||
virtual void handleMessage(MessageRefresh* message);
|
||||
virtual void handleMessage(MessageSwitchColorScheme* message);
|
||||
|
||||
void startMessagingAndScheduling();
|
||||
|
||||
|
||||
@@ -196,15 +196,6 @@ void FeatureController::handleMessage(MessageResetZoom* message)
|
||||
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)
|
||||
{
|
||||
bool zoomIn = message->zoomIn;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "utility/messaging/type/MessageActivateTokenLocations.h"
|
||||
#include "utility/messaging/type/MessageResetZoom.h"
|
||||
#include "utility/messaging/type/MessageSearch.h"
|
||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||
#include "utility/messaging/type/MessageZoom.h"
|
||||
|
||||
class StorageAccess;
|
||||
@@ -27,7 +26,6 @@ class FeatureController
|
||||
, public MessageListener<MessageActivateTokenLocations>
|
||||
, public MessageListener<MessageResetZoom>
|
||||
, public MessageListener<MessageSearch>
|
||||
, public MessageListener<MessageSwitchColorScheme>
|
||||
, public MessageListener<MessageZoom>
|
||||
{
|
||||
public:
|
||||
@@ -44,7 +42,6 @@ private:
|
||||
virtual void handleMessage(MessageActivateTokenIds* message);
|
||||
virtual void handleMessage(MessageActivateTokenLocations* message);
|
||||
virtual void handleMessage(MessageResetZoom* message);
|
||||
virtual void handleMessage(MessageSwitchColorScheme* message);
|
||||
virtual void handleMessage(MessageZoom* message);
|
||||
|
||||
StorageAccess* m_storageAccess;
|
||||
|
||||
@@ -95,12 +95,12 @@ void ApplicationSettings::setFontSize(int fontSize)
|
||||
setValue<int>("application/font_size", fontSize);
|
||||
}
|
||||
|
||||
std::string ApplicationSettings::getColorSchemePath() const
|
||||
FilePath ApplicationSettings::getColorSchemePath() const
|
||||
{
|
||||
std::string defaultPath = ResourcePaths::getColorSchemesPath() + "bright.xml";
|
||||
std::string path = getValue<std::string>("application/color_scheme", defaultPath);
|
||||
FilePath defaultPath(ResourcePaths::getColorSchemesPath() + "bright.xml");
|
||||
FilePath path(getValue<std::string>("application/color_scheme", defaultPath.str()));
|
||||
|
||||
if (path != defaultPath && !FilePath(path).exists())
|
||||
if (path != defaultPath && !path.exists())
|
||||
{
|
||||
return defaultPath;
|
||||
}
|
||||
@@ -108,9 +108,9 @@ std::string ApplicationSettings::getColorSchemePath() const
|
||||
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
|
||||
|
||||
@@ -35,8 +35,8 @@ public:
|
||||
int getFontSize() const;
|
||||
void setFontSize(int fontSize);
|
||||
|
||||
std::string getColorSchemePath() const;
|
||||
void setColorSchemePath(const std::string& colorSchemePath);
|
||||
FilePath getColorSchemePath() const;
|
||||
void setColorSchemePath(const FilePath& colorSchemePath);
|
||||
|
||||
int getFontSizeMax() const;
|
||||
void setFontSizeMax(const int fontSizeMax);
|
||||
|
||||
@@ -7,8 +7,8 @@ class MessageSwitchColorScheme
|
||||
: public Message<MessageSwitchColorScheme>
|
||||
{
|
||||
public:
|
||||
MessageSwitchColorScheme(const std::string& filePath)
|
||||
: colorSchemeFilePath(filePath)
|
||||
MessageSwitchColorScheme(const FilePath& filePath)
|
||||
: colorSchemePath(filePath)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ public:
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user