# HG changeset patch # User Santeri Piippo # Date 1377022439 -10800 # Node ID 3779a14d597c3fa24697d89c1ea06f469af8032b # Parent 22bdcca9f78d3b65f3927bc8f118fcc9b1cbb873 added profile data auto-filling diff -r 22bdcca9f78d -r 3779a14d597c changelog.txt --- a/changelog.txt Tue Aug 20 15:01:16 2013 +0300 +++ b/changelog.txt Tue Aug 20 21:13:59 2013 +0300 @@ -17,6 +17,8 @@ - Added support for logoed studs, this should satisfy Steffen. :p - Added support for '0 BFC CLIP' and '0 BFC NOCLIP' and added auto-correction from errorneous MLCAD syntax ('0 BFC CERTIFY CLIP'). +- Added config fields for default name/username/license. This data will be automatically filled + into forms that require such information. - When an external program is attempted to be used without a binary path defined, one will be asked with an input dialog instead of being told to go to configuration to set the path. - When adding edges with Intersector (which is done with Isecalc), the user is prompted for Isecalc's diff -r 22bdcca9f78d -r 3779a14d597c src/config.cpp --- a/src/config.cpp Tue Aug 20 15:01:16 2013 +0300 +++ b/src/config.cpp Tue Aug 20 21:13:59 2013 +0300 @@ -47,7 +47,8 @@ Config::Config (const char* name, const char* defstring) : name (name), m_defstring (defstring) { - assert (getType() != None); + if (getType() != None) + fatal (fmt ("Config `%1` is of unknown type!", name)); } // ============================================================================= diff -r 22bdcca9f78d -r 3779a14d597c src/configDialog.cpp --- a/src/configDialog.cpp Tue Aug 20 15:01:16 2013 +0300 +++ b/src/configDialog.cpp Tue Aug 20 21:13:59 2013 +0300 @@ -51,7 +51,9 @@ extern_cfg (Bool, net_guesspaths); extern_cfg (Bool, net_autoclose); extern_cfg (Bool, gl_logostuds); - +extern_cfg (String, ld_defaultname); +extern_cfg (String, ld_defaultuser); +extern_cfg (Int, ld_defaultlicense); extern_cfg (String, prog_ytruder); extern_cfg (String, prog_rectifier); extern_cfg (String, prog_intersector); @@ -91,6 +93,10 @@ ui->guessNetPaths->setChecked (net_guesspaths); ui->autoCloseNetPrompt->setChecked (net_autoclose); connect (ui->findDownloadPath, SIGNAL (clicked(bool)), this, SLOT (slot_findDownloadFolder())); + + ui->m_profileName->setText (ld_defaultname); + ui->m_profileUsername->setText (ld_defaultuser); + ui->m_profileLicense->setCurrentIndex (ld_defaultlicense); } // ============================================================================= @@ -580,18 +586,23 @@ ConfigDialog dlg (g_win); if (dlg.exec()) { + const alias ui = *dlg.getUI(); + // Apply configuration - lv_colorize = dlg.getUI()->colorizeObjects->isChecked(); - gl_colorbfc = dlg.getUI()->colorBFC->isChecked(); - // edit_schemanticinline = dlg.getUI()->scemanticInlining->isChecked(); - gl_blackedges = dlg.getUI()->blackEdges->isChecked(); - gl_maincolor_alpha = ((double) dlg.getUI()->mainColorAlpha->value()) / 10.0f; - gl_linethickness = dlg.getUI()->lineThickness->value(); - gui_implicitfiles = dlg.getUI()->implicitFiles->isChecked(); - net_downloadpath = dlg.getUI()->downloadPath->text(); - net_guesspaths = dlg.getUI()->guessNetPaths->isChecked(); - net_autoclose = dlg.getUI()->autoCloseNetPrompt->isChecked(); - gl_logostuds = dlg.getUI()->m_logostuds->isChecked(); + lv_colorize = ui.colorizeObjects->isChecked(); + gl_colorbfc = ui.colorBFC->isChecked(); + // edit_schemanticinline = ui.scemanticInlining->isChecked(); + gl_blackedges = ui.blackEdges->isChecked(); + gl_maincolor_alpha = ((double) ui.mainColorAlpha->value()) / 10.0f; + gl_linethickness = ui.lineThickness->value(); + gui_implicitfiles = ui.implicitFiles->isChecked(); + net_downloadpath = ui.downloadPath->text(); + net_guesspaths = ui.guessNetPaths->isChecked(); + net_autoclose = ui.autoCloseNetPrompt->isChecked(); + gl_logostuds = ui.m_logostuds->isChecked(); + ld_defaultuser = ui.m_profileUsername->text(); + ld_defaultname = ui.m_profileName->text(); + ld_defaultlicense = ui.m_profileLicense->currentIndex(); if (net_downloadpath.value.right (1) != DIRSLASH) net_downloadpath += DIRSLASH; diff -r 22bdcca9f78d -r 3779a14d597c src/gui_actions.cpp --- a/src/gui_actions.cpp Tue Aug 20 15:01:16 2013 +0300 +++ b/src/gui_actions.cpp Tue Aug 20 21:13:59 2013 +0300 @@ -39,6 +39,9 @@ extern_cfg (Bool, gl_wireframe); extern_cfg (Bool, gl_colorbfc); +extern_cfg (String, ld_defaultname); +extern_cfg (String, ld_defaultuser); +extern_cfg (Int, ld_defaultlicense); // ============================================================================= // ----------------------------------------------------------------------------- @@ -47,6 +50,32 @@ Ui::NewPartUI ui; ui.setupUi (dlg); + str authortext = ld_defaultname; + + if (!ld_defaultuser.value.isEmpty()) + authortext.append (fmt (" [%1]", ld_defaultuser)); + + ui.le_author->setText (authortext); + + switch (ld_defaultlicense) { + case 0: + ui.rb_license_ca->setChecked (true); + break; + + case 1: + ui.rb_license_nonca->setChecked (true); + break; + + case 2: + ui.rb_license_none->setChecked (true); + break; + + default: + QMessageBox::warning (null, "Warning", + fmt ("Unknown ld_defaultlicense value %1!", ld_defaultlicense)); + break; + } + if (dlg->exec() == false) return; diff -r 22bdcca9f78d -r 3779a14d597c src/gui_editactions.cpp --- a/src/gui_editactions.cpp Tue Aug 20 15:01:16 2013 +0300 +++ b/src/gui_editactions.cpp Tue Aug 20 21:13:59 2013 +0300 @@ -36,6 +36,7 @@ #include "ui_addhistoryline.h" cfg (Bool, edit_schemanticinline, false); +extern_cfg (String, ld_defaultuser); // ============================================================================= // ----------------------------------------------------------------------------- @@ -674,6 +675,7 @@ QDialog* dlg = new QDialog; Ui_AddHistoryLine* ui = new Ui_AddHistoryLine; ui->setupUi (dlg); + ui->m_username->setText (ld_defaultuser); ui->m_date->setDate (QDate::currentDate()); ui->m_comment->setFocus(); diff -r 22bdcca9f78d -r 3779a14d597c src/ldtypes.cpp --- a/src/ldtypes.cpp Tue Aug 20 15:01:16 2013 +0300 +++ b/src/ldtypes.cpp Tue Aug 20 21:13:59 2013 +0300 @@ -25,6 +25,10 @@ #include "gldraw.h" #include "colors.h" +cfg (String, ld_defaultname, ""); +cfg (String, ld_defaultuser, ""); +cfg (Int, ld_defaultlicense, 0); + // List of all LDObjects List g_LDObjects; diff -r 22bdcca9f78d -r 3779a14d597c src/ui/config.ui --- a/src/ui/config.ui Tue Aug 20 15:01:16 2013 +0300 +++ b/src/ui/config.ui Tue Aug 20 21:13:59 2013 +0300 @@ -6,7 +6,7 @@ 0 0 - 513 + 561 351 @@ -40,7 +40,7 @@ - General + Interface @@ -260,6 +260,91 @@ + + + Profile + + + + + + Profile + + + + + + + + Username: + + + + + + + Name: + + + + + + + License: + + + + + + + + + + + + + + 0 + 0 + + + + + CA - redistributable + + + + + NonCA - not redistributable + + + + + None + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Shortcuts