mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 01:20:17 +00:00
Add link label in Options dialog to locate the configuration file
This commit is contained in:
parent
b54ed9cfe7
commit
3c959233b6
@ -70,7 +70,8 @@
|
||||
<separator horizontal="true" />
|
||||
|
||||
<box horizontal="true">
|
||||
<box horizontal="true" expansive="true" />
|
||||
<link id="locate_file" text="Locate File" />
|
||||
<boxfiller />
|
||||
<box horizontal="true" homogeneous="true">
|
||||
<button text="&OK" closewindow="true" id="button_ok" magnet="true" width="60" />
|
||||
<button text="&Cancel" closewindow="true" />
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "app/context.h"
|
||||
#include "app/find_widget.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/launcher.h"
|
||||
#include "app/load_widget.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
@ -51,6 +52,7 @@ protected:
|
||||
|
||||
private:
|
||||
void onResetCheckedBg();
|
||||
void onLocateConfigFile();
|
||||
|
||||
ComboBox* m_checked_bg;
|
||||
Widget* m_checked_bg_zoom;
|
||||
@ -83,6 +85,7 @@ void OptionsCommand::onExecute(Context* context)
|
||||
Widget* undo_size_limit = app::find_widget<Widget>(window, "undo_size_limit");
|
||||
Widget* undo_goto_modified = app::find_widget<Widget>(window, "undo_goto_modified");
|
||||
ComboBox* screen_scale = app::find_widget<ComboBox>(window, "screen_scale");
|
||||
LinkLabel* locate_file = app::find_widget<LinkLabel>(window, "locate_file");
|
||||
Widget* button_ok = app::find_widget<Widget>(window, "button_ok");
|
||||
|
||||
// Cursor color
|
||||
@ -142,6 +145,9 @@ void OptionsCommand::onExecute(Context* context)
|
||||
// Reset button
|
||||
checked_bg_reset->Click.connect(Bind<void>(&OptionsCommand::onResetCheckedBg, this));
|
||||
|
||||
// Locate config file
|
||||
locate_file->Click.connect(Bind<void>(&OptionsCommand::onLocateConfigFile, this));
|
||||
|
||||
// Undo limit
|
||||
undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8));
|
||||
|
||||
@ -197,6 +203,11 @@ void OptionsCommand::onResetCheckedBg()
|
||||
m_checked_bg_color2->setColor(app::Color::fromRgb(192, 192, 192));
|
||||
}
|
||||
|
||||
void OptionsCommand::onLocateConfigFile()
|
||||
{
|
||||
app::launcher::open_folder(app::get_config_file());
|
||||
}
|
||||
|
||||
Command* CommandFactory::createOptionsCommand()
|
||||
{
|
||||
return new OptionsCommand;
|
||||
|
@ -33,6 +33,8 @@ namespace app {
|
||||
|
||||
using namespace gfx;
|
||||
|
||||
static std::string g_configFilename;
|
||||
|
||||
ConfigModule::ConfigModule()
|
||||
{
|
||||
ResourceFinder rf;
|
||||
@ -50,6 +52,7 @@ ConfigModule::ConfigModule()
|
||||
config_filename = rf.filename();
|
||||
|
||||
override_config_file(config_filename.c_str());
|
||||
g_configFilename = config_filename;
|
||||
}
|
||||
|
||||
ConfigModule::~ConfigModule()
|
||||
@ -58,6 +61,11 @@ ConfigModule::~ConfigModule()
|
||||
flush_config_file();
|
||||
}
|
||||
|
||||
std::string get_config_file()
|
||||
{
|
||||
return g_configFilename;
|
||||
}
|
||||
|
||||
bool get_config_bool(const char *section, const char *name, bool value)
|
||||
{
|
||||
const char *got = get_config_string(section, name, value ? "yes": "no");
|
||||
|
@ -32,6 +32,8 @@ namespace app {
|
||||
~ConfigModule();
|
||||
};
|
||||
|
||||
std::string get_config_file();
|
||||
|
||||
bool get_config_bool(const char *section, const char *name, bool value);
|
||||
void set_config_bool(const char *section, const char *name, bool value);
|
||||
|
||||
|
@ -278,6 +278,23 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
(bottom ? JI_BOTTOM: JI_MIDDLE)));
|
||||
}
|
||||
}
|
||||
/* link */
|
||||
else if (elem_name == "link") {
|
||||
const char* text = elem->Attribute("text");
|
||||
const char* url = elem->Attribute("url");
|
||||
|
||||
widget = new LinkLabel(url ? url: "", text ? TRANSLATE_ATTR(text): "");
|
||||
if (widget) {
|
||||
bool center = bool_attr_is_true(elem, "center");
|
||||
bool right = bool_attr_is_true(elem, "right");
|
||||
bool top = bool_attr_is_true(elem, "top");
|
||||
bool bottom = bool_attr_is_true(elem, "bottom");
|
||||
|
||||
widget->setAlign(
|
||||
(center ? JI_CENTER: (right ? JI_RIGHT: JI_LEFT)) |
|
||||
(top ? JI_TOP: (bottom ? JI_BOTTOM: JI_MIDDLE)));
|
||||
}
|
||||
}
|
||||
/* listbox */
|
||||
else if (elem_name == "listbox") {
|
||||
widget = new ListBox();
|
||||
|
Loading…
x
Reference in New Issue
Block a user