Enhancement: 'relative' option of properties dialog is persisted now.

This commit is contained in:
Matthias Koefferlein 2025-08-15 15:23:54 +02:00
parent ef2b164e1a
commit 872eaabb75
4 changed files with 32 additions and 0 deletions

View File

@ -85,6 +85,7 @@ public:
options.push_back (std::pair<std::string, std::string> (cfg_reader_options_show_always, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_assistant_bookmarks, ""));
options.push_back (std::pair<std::string, std::string> (cfg_always_exit_without_saving, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_properties_dialog_relative_mode, "true"));
}
virtual std::vector<std::pair <std::string, ConfigPage *> > config_pages (QWidget *parent) const

View File

@ -158,6 +158,8 @@ static const std::string cfg_guiding_shape_color ("guiding-shape-color");
static const std::string cfg_guiding_shape_line_width ("guiding-shape-line-width");
static const std::string cfg_guiding_shape_vertex_size ("guiding-shape-vertex-size");
static const std::string cfg_properties_dialog_relative_mode ("properties-dialog-relative-mode");
}
#endif

View File

@ -27,6 +27,8 @@
#include "tlLog.h"
#include "layEditable.h"
#include "layProperties.h"
#include "layDispatcher.h"
#include "laybasicConfig.h"
#include "tlExceptions.h"
#include "ui_PropertiesDialog.h"
@ -246,6 +248,8 @@ PropertiesDialog::PropertiesDialog (QWidget * /*parent*/, db::Manager *manager,
mp_ui->apply_to_all_cbx->setChecked (false);
mp_ui->relative_cbx->setChecked (true);
fetch_config ();
connect (mp_ui->ok_button, SIGNAL (clicked ()), this, SLOT (ok_pressed ()));
connect (mp_ui->cancel_button, SIGNAL (clicked ()), this, SLOT (cancel_pressed ()));
connect (mp_ui->prev_button, SIGNAL (clicked ()), this, SLOT (prev_pressed ()));
@ -263,6 +267,26 @@ PropertiesDialog::~PropertiesDialog ()
disconnect ();
}
void
PropertiesDialog::fetch_config ()
{
if (! lay::Dispatcher::instance ()) {
return;
}
bool rm = true;
lay::Dispatcher::instance ()->config_get (cfg_properties_dialog_relative_mode, rm);
mp_ui->relative_cbx->setChecked (rm);
}
void
PropertiesDialog::store_config ()
{
if (lay::Dispatcher::instance ()) {
lay::Dispatcher::instance ()->config_set (cfg_properties_dialog_relative_mode, mp_ui->relative_cbx->isChecked ());
}
}
void
PropertiesDialog::disconnect ()
{
@ -617,6 +641,7 @@ PropertiesDialog::cancel_pressed ()
}
store_config ();
// make sure that the property pages are no longer used ..
disconnect ();
// close the dialog
@ -641,6 +666,7 @@ BEGIN_PROTECTED
}
store_config ();
// make sure that the property pages are no longer used ..
disconnect ();
QDialog::accept ();
@ -651,6 +677,7 @@ END_PROTECTED
void
PropertiesDialog::reject ()
{
store_config ();
// make sure that the property pages are no longer used ..
disconnect ();
QDialog::reject ();

View File

@ -99,6 +99,8 @@ private:
const std::vector<lay::PropertiesPage *> &properties_pages () { return mp_properties_pages; }
void disconnect ();
void fetch_config ();
void store_config ();
bool any_prev () const;
bool any_next () const;
void update_title ();