removed the old Add History Line tool

Sat, 17 Mar 2018 11:35:07 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 17 Mar 2018 11:35:07 +0200
changeset 1293
52732b1db3f0
parent 1292
66d2050d3bd9
child 1294
adaad0b329e2

removed the old Add History Line tool

CMakeLists.txt file | annotate | diff | comparison | revisions
src/dialogs/addhistorylinedialog.ui file | annotate | diff | comparison | revisions
src/mainwindow.ui file | annotate | diff | comparison | revisions
src/toolsets/algorithmtoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/algorithmtoolset.h file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Sat Mar 17 11:33:05 2018 +0200
+++ b/CMakeLists.txt	Sat Mar 17 11:35:07 2018 +0200
@@ -165,7 +165,6 @@
 
 set (LDFORGE_FORMS
 	src/dialogs/aboutdialog.ui
-	src/dialogs/addhistorylinedialog.ui
 	src/dialogs/colorselector.ui
 	src/dialogs/configdialog.ui
 	src/dialogs/covererdialog.ui
--- a/src/dialogs/addhistorylinedialog.ui	Sat Mar 17 11:33:05 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AddHistoryLine</class>
- <widget class="QDialog" name="AddHistoryLine">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>410</width>
-    <height>120</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Add History Line</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <layout class="QFormLayout" name="formLayout">
-     <item row="0" column="0">
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Date:</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1">
-      <widget class="QDateEdit" name="m_date"/>
-     </item>
-     <item row="1" column="0">
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Username:</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1">
-      <widget class="QLineEdit" name="m_username"/>
-     </item>
-     <item row="2" column="0">
-      <widget class="QLabel" name="label_3">
-       <property name="text">
-        <string>Comment:</string>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="1">
-      <widget class="QLineEdit" name="m_comment"/>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>AddHistoryLine</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>AddHistoryLine</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
--- a/src/mainwindow.ui	Sat Mar 17 11:33:05 2018 +0200
+++ b/src/mainwindow.ui	Sat Mar 17 11:35:07 2018 +0200
@@ -43,6 +43,14 @@
          <number>0</number>
         </property>
         <widget class="QWidget" name="page">
+         <property name="geometry">
+          <rect>
+           <x>0</x>
+           <y>0</y>
+           <width>465</width>
+           <height>362</height>
+          </rect>
+         </property>
          <attribute name="label">
           <string>Header</string>
          </attribute>
@@ -313,7 +321,6 @@
     <addaction name="actionInlineDeep"/>
     <addaction name="actionMakePrimitive"/>
     <addaction name="separator"/>
-    <addaction name="actionAddHistoryLine"/>
     <addaction name="separator"/>
     <addaction name="actionSplitQuads"/>
     <addaction name="actionEditRaw"/>
@@ -1523,11 +1530,6 @@
     <string>&amp;Download From...</string>
    </property>
   </action>
-  <action name="actionAddHistoryLine">
-   <property name="text">
-    <string>Add History Line</string>
-   </property>
-  </action>
   <action name="actionJumpTo">
    <property name="text">
     <string>&amp;Go to Line...</string>
--- a/src/toolsets/algorithmtoolset.cpp	Sat Mar 17 11:33:05 2018 +0200
+++ b/src/toolsets/algorithmtoolset.cpp	Sat Mar 17 11:35:07 2018 +0200
@@ -39,7 +39,6 @@
 #include "ui_replacecoordinatesdialog.h"
 #include "ui_editrawdialog.h"
 #include "ui_flipdialog.h"
-#include "ui_addhistorylinedialog.h"
 #include "algorithmtoolset.h"
 
 AlgorithmToolset::AlgorithmToolset (MainWindow* parent) :
@@ -349,52 +348,6 @@
 	print (tr ("Auto-colored: new color is [%1] %2"), color.index(), color.name());
 }
 
-void AlgorithmToolset::addHistoryLine()
-{
-	LDObject* obj;
-	bool ishistory = false;
-	bool prevIsHistory = false;
-
-	QDialog dialog {m_window};
-	Ui_AddHistoryLine ui;
-	ui.setupUi(&dialog);
-	ui.m_username->setText (m_config->defaultUser());
-	ui.m_date->setDate (QDate::currentDate());
-	ui.m_comment->setFocus();
-
-	if (not dialog.exec())
-		return;
-
-	// Find a spot to place the new comment
-	for (obj = currentDocument()->getObject (0);
-		obj and next(obj) and not next(obj)->isScemantic();
-		obj = next(obj))
-	{
-		LDComment* comment = dynamic_cast<LDComment*> (obj);
-
-		if (comment and comment->text().startsWith ("!HISTORY "))
-			ishistory = true;
-
-		if (prevIsHistory and not ishistory)
-			break; // Last line was history, this isn't, thus insert the new history line here.
-
-		prevIsHistory = ishistory;
-	}
-
-	int idx = obj ? currentDocument()->indexOf(obj).row() : 0;
-
-	// Create the comment object based on input
-	currentDocument()->emplaceAt<LDComment>(idx++, format("!HISTORY %1 [%2] %3",
-	    ui.m_date->date().toString ("yyyy-MM-dd"),
-	    ui.m_username->text(),
-	    ui.m_comment->text()));
-
-	// If we're adding a history line right before a scemantic object, pad it
-	// an empty line
-	if (obj and next(obj) and next(obj)->isScemantic())
-		currentDocument()->emplaceAt<LDEmpty>(idx);
-}
-
 void AlgorithmToolset::splitLines()
 {
 	bool ok;
--- a/src/toolsets/algorithmtoolset.h	Sat Mar 17 11:33:05 2018 +0200
+++ b/src/toolsets/algorithmtoolset.h	Sat Mar 17 11:35:07 2018 +0200
@@ -25,7 +25,6 @@
 public:
 	explicit AlgorithmToolset (MainWindow* parent);
 
-	Q_INVOKABLE void addHistoryLine();
 	Q_INVOKABLE void autocolor();
 	Q_INVOKABLE void demote();
 	Q_INVOKABLE void editRaw();

mercurial