- fixed various compilation issues

Sun, 09 Mar 2014 14:58:46 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 09 Mar 2014 14:58:46 +0200
changeset 653
a9966d51ebf1
parent 652
5d37b2f2ae16
child 654
a74f2ff353b8
child 691
ed26a5bbd585

- fixed various compilation issues

src/Dialogs.h file | annotate | diff | comparison | revisions
src/GLRenderer.cc file | annotate | diff | comparison | revisions
src/MainWindow.cc file | annotate | diff | comparison | revisions
src/MainWindow.h file | annotate | diff | comparison | revisions
src/Types.cc file | annotate | diff | comparison | revisions
src/Types.h file | annotate | diff | comparison | revisions
--- a/src/Dialogs.h	Wed Mar 05 20:49:28 2014 +0200
+++ b/src/Dialogs.h	Sun Mar 09 14:58:46 2014 +0200
@@ -55,7 +55,7 @@
 
 	private:
 		Ui_OverlayUI* ui;
-		QList<pair<QRadioButton*, int>> m_cameraArgs;
+		QList<Pair<QRadioButton*, int>> m_cameraArgs;
 
 	private slots:
 		void slot_fpath();
--- a/src/GLRenderer.cc	Wed Mar 05 20:49:28 2014 +0200
+++ b/src/GLRenderer.cc	Sun Mar 09 14:58:46 2014 +0200
@@ -1594,7 +1594,7 @@
 				transform = getCircleDrawMatrix ((dist0 != 0) ? dist0 : dist1);
 				circleOrDisc = true;
 			}
-			elif (g_RingFinder (dist0, dist1))
+			elif (g_RingFinder.findRings (dist0, dist1))
 			{
 				// The ring finder found a solution, use that. Add the component rings to the file.
 				for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents())
--- a/src/MainWindow.cc	Wed Mar 05 20:49:28 2014 +0200
+++ b/src/MainWindow.cc	Sun Mar 09 14:58:46 2014 +0200
@@ -64,8 +64,8 @@
 
 // =============================================================================
 //
-
-MainWindow::MainWindow (QWidget* parent, Qt::WindowFlags flags)
+MainWindow::MainWindow (QWidget* parent, Qt::WindowFlags flags) :
+	QMainWindow (parent, flags)
 {
 	g_win = this;
 	ui = new Ui_LDForgeUI;
@@ -811,25 +811,30 @@
 }
 
 // =============================================================================
-bool confirm (QString msg)
+//
+bool confirm (const QString& message)
 {
 	return confirm (MainWindow::tr ("Confirm"), message);
 }
 
-bool confirm (QString title, QString msg)
+// =============================================================================
+//
+bool confirm (const QString& title, const QString& message)
 {
-	return QMessageBox::question (g_win, title, messag,
+	return QMessageBox::question (g_win, title, message,
 		(QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes;
 }
 
 // =============================================================================
-void critical (QString msg)
+//
+void critical (const QString& message)
 {
 	QMessageBox::critical (g_win, MainWindow::tr ("Error"), message,
 		(QMessageBox::Close), QMessageBox::Close);
 }
 
 // =============================================================================
+//
 QIcon makeColorIcon (LDColor* colinfo, const int size)
 {
 	// Create an image object and link a painter to it.
@@ -856,6 +861,7 @@
 }
 
 // =============================================================================
+//
 void makeColorComboBox (QComboBox* box)
 {
 	std::map<int, int> counts;
@@ -888,6 +894,8 @@
 	}
 }
 
+// =============================================================================
+//
 void MainWindow::updateDocumentList()
 {
 	m_updatingTabs = true;
@@ -910,6 +918,8 @@
 	m_updatingTabs = false;
 }
 
+// =============================================================================
+//
 void MainWindow::updateDocumentListItem (LDDocument* doc)
 {
 	bool oldUpdatingTabs = m_updatingTabs;
@@ -936,8 +946,10 @@
 }
 
 // =============================================================================
+//
 // A file is selected from the list of files on the left of the screen. Find out
 // which file was picked and change to it.
+//
 void MainWindow::changeCurrentFile()
 {
 	if (m_updatingTabs)
@@ -964,6 +976,8 @@
 	LDDocument::setCurrent (f);
 }
 
+// =============================================================================
+//
 void MainWindow::refreshObjectList()
 {
 #if 0
@@ -978,6 +992,8 @@
 	buildObjList();
 }
 
+// =============================================================================
+//
 void MainWindow::updateActions()
 {
 	History* his = getCurrentDocument()->history();
@@ -989,6 +1005,8 @@
 	ui->actionDrawAngles->setChecked (gl_drawangles);
 }
 
+// =============================================================================
+//
 QImage imageFromScreencap (uchar* data, int w, int h)
 {
 	// GL and Qt formats have R and B swapped. Also, GL flips Y - correct it as well.
@@ -1001,11 +1019,15 @@
 	m_color (color),
 	m_toolButton (toolButton) {}
 
+// =============================================================================
+//
 LDQuickColor LDQuickColor::getSeparator()
 {
 	return LDQuickColor (null, null);
 }
 
+// =============================================================================
+//
 bool LDQuickColor::isSeparator() const
 {
 	return color() == null;
--- a/src/MainWindow.h	Wed Mar 05 20:49:28 2014 +0200
+++ b/src/MainWindow.h	Sun Mar 09 14:58:46 2014 +0200
@@ -191,6 +191,8 @@
 		//! Gets the shortcut configuration for the given \c action
 		KeySequenceConfig* shortcutForAction (QAction* action);
 
+		void endAction();
+
 	public slots:
 		void changeCurrentFile();
 		void slot_action();
@@ -303,8 +305,6 @@
 		QTabBar*			m_tabs;
 		bool				m_updatingTabs;
 
-		void endAction();
-
 	private slots:
 		void slot_selectionChanged();
 		void slot_recentFile();
@@ -325,15 +325,15 @@
 //! Asks the user a yes/no question with the given \c message and the given
 //! window \c title.
 //! \returns true if the user answered yes, false if no.
-bool confirm (QString title, QString message); // Generic confirm prompt
+bool confirm (const QString& title, const QString& message); // Generic confirm prompt
 
 //! An overload of \c confirm(), this asks the user a yes/no question with the
 //! given \c message.
 //! \returns true if the user answered yes, false if no.
-bool confirm (QString message);
+bool confirm (const QString& message);
 
 //! Displays an error prompt with the given \c message
-void critical (QString message);
+void critical (const QString& message);
 
 //! Makes an icon of \c size x \c size pixels to represent \c colinfo
 QIcon makeColorIcon (LDColor* colinfo, const int size);
@@ -351,9 +351,9 @@
 //! \returns by the user.
 //!
 template<class T>
-T radioSwitch (const T& defval, QList<pair<QRadioButton*, T>> haystack)
+T radioSwitch (const T& defval, QList<Pair<QRadioButton*, T>> haystack)
 {
-	for (pair<QRadioButton*, const T&> i : haystack)
+	for (Pair<QRadioButton*, const T&> i : haystack)
 		if (i.first->isChecked())
 			return i.second;
 
@@ -365,9 +365,9 @@
 //! found radio button whose respsective value matches \c expr have the given value.
 //!
 template<class T>
-void radioDefault (const T& expr, QList<pair<QRadioButton*, T>> haystack)
+void radioDefault (const T& expr, QList<Pair<QRadioButton*, T>> haystack)
 {
-	for (pair<QRadioButton*, const T&> i : haystack)
+	for (Pair<QRadioButton*, const T&> i : haystack)
 	{
 		if (i.second == expr)
 		{
--- a/src/Types.cc	Wed Mar 05 20:49:28 2014 +0200
+++ b/src/Types.cc	Sun Mar 09 14:58:46 2014 +0200
@@ -189,7 +189,7 @@
 
 // =============================================================================
 //
-Matrix::Matrix (QList<double> vals)
+Matrix::Matrix (const std::initializer_list< double >& vals)
 {
 	assert (vals.size() == 9);
 	memcpy (&m_vals[0], & (*vals.begin()), sizeof m_vals);
--- a/src/Types.h	Wed Mar 05 20:49:28 2014 +0200
+++ b/src/Types.h	Sun Mar 09 14:58:46 2014 +0200
@@ -62,7 +62,7 @@
 
 		//! Constructs a matrix with the given values.
 		//! \note \c vals is expected to have exactly 9 elements.
-		Matrix (const QList<double>& vals);
+		Matrix (const std::initializer_list<double>& vals);
 
 		//! Constructs a matrix all 9 elements initialized to the same value.
 		//! \param fillval the value to initialize the matrix coordinates as
@@ -150,7 +150,8 @@
 {
 	public:
 		//! Constructs a zero vertex
-		Vertex() : m_coords({0, 0, 0}) {}
+		Vertex() :
+			m_coords{0, 0, 0} {}
 
 		//! Constructs a vertex with the given \c x, \c y and \c z.
 		Vertex (double x, double y, double z);

mercurial