Tue, 20 Aug 2013 21:13:59 +0300
added profile data auto-filling
changelog.txt | file | annotate | diff | comparison | revisions | |
src/config.cpp | file | annotate | diff | comparison | revisions | |
src/configDialog.cpp | file | annotate | diff | comparison | revisions | |
src/gui_actions.cpp | file | annotate | diff | comparison | revisions | |
src/gui_editactions.cpp | file | annotate | diff | comparison | revisions | |
src/ldtypes.cpp | file | annotate | diff | comparison | revisions | |
src/ui/config.ui | file | annotate | diff | comparison | revisions |
--- 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
--- 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)); } // =============================================================================
--- 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;
--- 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;
--- 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();
--- 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<LDObject*> g_LDObjects;
--- 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 @@ <rect> <x>0</x> <y>0</y> - <width>513</width> + <width>561</width> <height>351</height> </rect> </property> @@ -40,7 +40,7 @@ </property> <widget class="QWidget" name="tab"> <attribute name="title"> - <string>General</string> + <string>Interface</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> @@ -260,6 +260,91 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab_7"> + <attribute name="title"> + <string>Profile</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_10"> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Profile</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <layout class="QFormLayout" name="formLayout_3"> + <item row="2" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Username:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Name:</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>License:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="m_profileName"/> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="m_profileUsername"/> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="m_profileLicense"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <item> + <property name="text"> + <string>CA - redistributable</string> + </property> + </item> + <item> + <property name="text"> + <string>NonCA - not redistributable</string> + </property> + </item> + <item> + <property name="text"> + <string>None</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_7"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + </layout> + </widget> <widget class="QWidget" name="tab_2"> <attribute name="title"> <string>Shortcuts</string>