Wrap code for better readability

This commit is contained in:
Simon De Backer
2020-08-18 21:46:39 +02:00
parent 566747eb2b
commit 5dd57cf003
5 changed files with 111 additions and 45 deletions

View File

@@ -28,7 +28,9 @@
* la zone exportee est le schema avec son cadre et son cartouche
*/
ExportProperties::ExportProperties() :
destination_directory(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)),
destination_directory(
QStandardPaths::writableLocation(
QStandardPaths::DesktopLocation)),
format("PNG"),
draw_grid(false),
draw_border(true),
@@ -50,15 +52,25 @@ ExportProperties::~ExportProperties() {
@param settings Parametres a ecrire
@param prefix prefixe a ajouter devant les noms des parametres
*/
void ExportProperties::toSettings(QSettings &settings, const QString &prefix) const {
settings.setValue(prefix + "path", QDir::toNativeSeparators(destination_directory.absolutePath()));
settings.setValue(prefix + "format", format);
settings.setValue(prefix + "drawgrid", draw_grid);
settings.setValue(prefix + "drawborder", draw_border);
settings.setValue(prefix + "drawtitleblock", draw_titleblock);
settings.setValue(prefix + "drawterminals", draw_terminals);
settings.setValue(prefix + "drawcoloredconductors", draw_colored_conductors);
settings.setValue(prefix + "area", QET::diagramAreaToString(exported_area));
void ExportProperties::toSettings(QSettings &settings,
const QString &prefix) const {
settings.setValue(prefix + "path",
QDir::toNativeSeparators(
destination_directory.absolutePath()));
settings.setValue(prefix + "format",
format);
settings.setValue(prefix + "drawgrid",
draw_grid);
settings.setValue(prefix + "drawborder",
draw_border);
settings.setValue(prefix + "drawtitleblock",
draw_titleblock);
settings.setValue(prefix + "drawterminals",
draw_terminals);
settings.setValue(prefix + "drawcoloredconductors",
draw_colored_conductors);
settings.setValue(prefix + "area",
QET::diagramAreaToString(exported_area));
}
/**
@@ -66,20 +78,35 @@ void ExportProperties::toSettings(QSettings &settings, const QString &prefix) co
@param settings Parametres a lire
@param prefix prefixe a ajouter devant les noms des parametres
*/
void ExportProperties::fromSettings(QSettings &settings, const QString &prefix) {
QString desktop_path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
destination_directory.setPath(settings.value(prefix + "path", desktop_path).toString());
if (!destination_directory.exists()) destination_directory.setPath(desktop_path);
void ExportProperties::fromSettings(QSettings &settings,
const QString &prefix) {
QString desktop_path = QStandardPaths::writableLocation(
QStandardPaths::DesktopLocation);
destination_directory.setPath(
settings.value(
prefix + "path",
desktop_path).toString());
if (!destination_directory.exists())
destination_directory.setPath(desktop_path);
format = settings.value(prefix + "format").toString();
draw_grid = settings.value(prefix + "drawgrid", false).toBool();
draw_border = settings.value(prefix + "drawborder", true ).toBool();
draw_titleblock = settings.value(prefix + "drawtitleblock", true ).toBool();
draw_terminals = settings.value(prefix + "drawterminals", false).toBool();
draw_colored_conductors = settings.value(prefix + "drawcoloredconductors", true ).toBool();
exported_area = QET::diagramAreaFromString(settings.value(prefix + "area", "border").toString());
draw_grid = settings.value(prefix + "drawgrid",
false).toBool();
draw_border = settings.value(prefix + "drawborder",
true ).toBool();
draw_titleblock = settings.value(prefix + "drawtitleblock",
true ).toBool();
draw_terminals = settings.value(prefix + "drawterminals",
false).toBool();
draw_colored_conductors = settings.value(
prefix + "drawcoloredconductors",
true ).toBool();
exported_area = QET::diagramAreaFromString(
settings.value(
prefix + "area",
"border").toString());
}
/**