# HG changeset patch # User Santeri Piippo # Date 1401999493 -10800 # Node ID c254ddc6618b6fac70aa423cc6ec97a841d323b0 # Parent ceb1b1aaf7db44ae1142068444513b826653ad7d - source reformat diff -r ceb1b1aaf7db -r c254ddc6618b src/addObjectDialog.h --- a/src/addObjectDialog.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/addObjectDialog.h Thu Jun 05 23:18:13 2014 +0300 @@ -33,37 +33,37 @@ { Q_OBJECT - public: - AddObjectDialog (const LDObjectType type, LDObjectPtr obj, QWidget* parent = null); - static void staticDialog (const LDObjectType type, LDObjectPtr obj); +public: + AddObjectDialog (const LDObjectType type, LDObjectPtr obj, QWidget* parent = null); + static void staticDialog (const LDObjectType type, LDObjectPtr obj); - QLabel* lb_typeIcon; + QLabel* lb_typeIcon; - // Comment line edit - QLineEdit* le_comment; + // Comment line edit + QLineEdit* le_comment; - // Coordinate edits for.. anything with coordinates, really. - QDoubleSpinBox* dsb_coords[12]; + // Coordinate edits for.. anything with coordinates, really. + QDoubleSpinBox* dsb_coords[12]; - // Color selection dialog button - QPushButton* pb_color; + // Color selection dialog button + QPushButton* pb_color; - // BFC-related widgets - RadioGroup* rb_bfcType; + // BFC-related widgets + RadioGroup* rb_bfcType; - // Subfile stuff - QTreeWidget* tw_subfileList; - QLineEdit* le_subfileName; - QLabel* lb_subfileName; - QLineEdit* le_matrix; + // Subfile stuff + QTreeWidget* tw_subfileList; + QLineEdit* le_subfileName; + QLabel* lb_subfileName; + QLineEdit* le_matrix; - private: - void setButtonBackground (QPushButton* button, int color); - QString currentSubfileName(); +private: + void setButtonBackground (QPushButton* button, int color); + QString currentSubfileName(); - int colnum; + int colnum; - private slots: - void slot_colorButtonClicked(); - void slot_subfileTypeChanged(); +private slots: + void slot_colorButtonClicked(); + void slot_subfileTypeChanged(); }; diff -r ceb1b1aaf7db -r c254ddc6618b src/basics.h --- a/src/basics.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/basics.h Thu Jun 05 23:18:13 2014 +0300 @@ -56,9 +56,9 @@ Z }; -//! -//! Derivative of QVector3D: this class is used for the vertices. -//! +// +// Derivative of QVector3D: this class is used for the vertices. +// class Vertex : public QVector3D { public: @@ -81,96 +81,81 @@ Q_DECLARE_METATYPE (Vertex) -//! -//! \brief A mathematical 3 x 3 matrix -//! +// +// A mathematical 3 x 3 matrix +// class Matrix { - public: - //! Constructs a matrix with undetermined values. - Matrix() {} +public: + Matrix() {} + Matrix (const std::initializer_list& vals); - //! Constructs a matrix with the given values. - //! \note \c vals is expected to have exactly 9 elements. - Matrix (const std::initializer_list& vals); + // Constructs a matrix all 9 elements initialized to the same value. + Matrix (double fillval); - //! Constructs a matrix all 9 elements initialized to the same value. - //! \param fillval the value to initialize the matrix coordinates as - Matrix (double fillval); + // Constructs a matrix with a C-array. + // note: @vals is expected to have exactly 9 elements. + Matrix (double vals[]); - //! Constructs a matrix with a C-array. - //! \note \c vals is expected to have exactly 9 elements. - Matrix (double vals[]); - - //! Calculates the matrix's determinant. - //! \returns the calculated determinant. - double getDeterminant() const; + // Calculates the matrix's determinant. + double getDeterminant() const; - //! Multiplies this matrix with \c other - //! \param other the matrix to multiply with. - //! \returns the resulting matrix - //! \note a.mult(b) is not equivalent to b.mult(a)! - Matrix mult (const Matrix& other) const; + // Multiplies this matrix with @other + // note: a.mult(b) is not equivalent to b.mult(a)! + Matrix mult (const Matrix& other) const; - //! Prints the matrix to stdout. - void dump() const; + // Prints the matrix to stdout. + void dump() const; - //! \returns a string representation of the matrix. - QString toString() const; + // Yields a string representation of the matrix. + QString toString() const; - //! Zeroes the matrix out. - void zero(); + // Zeroes the matrix out. + void zero(); - //! Assigns the matrix values to the values of \c other. - //! \param other the matrix to assign this to. - //! \returns a reference to self - Matrix& operator= (const Matrix& other); + // Assigns the matrix values to the values of @other. + Matrix& operator= (const Matrix& other); - //! \returns a mutable reference to a value by \c idx - inline double& value (int idx) - { - return m_vals[idx]; - } + // Returns a mutable reference to a value by @idx + inline double& value (int idx) + { + return m_vals[idx]; + } - //! An overload of \c value() for const matrices. - //! \returns a const reference to a value by \c idx - inline const double& value (int idx) const - { - return m_vals[idx]; - } + // An overload of value() for const matrices. + inline const double& value (int idx) const + { + return m_vals[idx]; + } - //! An operator overload for \c mult(). - //! \returns the multiplied matrix. - inline Matrix operator* (const Matrix& other) const - { - return mult (other); - } + // An operator overload for mult(). + inline Matrix operator* (const Matrix& other) const + { + return mult (other); + } - //! An operator overload for \c value(). - //! \returns a mutable reference to a value by \c idx - inline double& operator[] (int idx) - { - return value (idx); - } + // An operator overload for value(). + inline double& operator[] (int idx) + { + return value (idx); + } - //! An operator overload for \c value() const. - //! \returns a const reference to a value by \c idx - inline const double& operator[] (int idx) const - { - return value (idx); - } + // An operator overload for value() const. + inline const double& operator[] (int idx) const + { + return value (idx); + } - //! \param other the matrix to check against - //! \returns whether the two matrices have the same values. - bool operator== (const Matrix& other) const; + // Checks whether the two matrices have the same values. + bool operator== (const Matrix& other) const; - private: - double m_vals[9]; +private: + double m_vals[9]; }; -//! -//! Defines a bounding box that encompasses a given set of objects. -//! vertex0 is the minimum vertex, vertex1 is the maximum vertex. +// +// Defines a bounding box that encompasses a given set of objects. +// vertex0 is the minimum vertex, vertex1 is the maximum vertex. // class LDBoundingBox { @@ -178,36 +163,36 @@ PROPERTY (private, Vertex, vertex0, setVertex0, STOCK_WRITE) PROPERTY (private, Vertex, vertex1, setVertex1, STOCK_WRITE) - public: - //! Constructs an empty bounding box. - LDBoundingBox(); +public: + // Constructs an empty bounding box. + LDBoundingBox(); - //! Clears the bounding box - void reset(); + // Clears the bounding box + void reset(); - //! Calculates the bounding box's values from the objects in the current - //! document. - void calculateFromCurrentDocument(); + // Calculates the bounding box's values from the objects in the current + // document. + void calculateFromCurrentDocument(); - //! \returns the length of the bounding box on the longest measure. - double longestMeasurement() const; + // Returns the length of the bounding box on the longest measure. + double longestMeasurement() const; - //! Calculates the given \c obj to the bounding box, adjusting - //! extremas if necessary. - void calcObject (LDObjectPtr obj); + // Calculates the given \c obj to the bounding box, adjusting + // extremas if necessary. + void calcObject (LDObjectPtr obj); - //! Calculates the given \c vertex to the bounding box, adjusting - //! extremas if necessary. - void calcVertex (const Vertex& vertex); + // Calculates the given \c vertex to the bounding box, adjusting + // extremas if necessary. + void calcVertex (const Vertex& vertex); - //! \returns the center of the bounding box. - Vertex center() const; + // Yields the center of the bounding box. + Vertex center() const; - //! An operator overload for \c calcObject() - LDBoundingBox& operator<< (LDObjectPtr obj); + // An operator overload for calcObject() + LDBoundingBox& operator<< (LDObjectPtr obj); - //! An operator overload for \c calcVertex() - LDBoundingBox& operator<< (const Vertex& v); + // An operator overload for calcVertex() + LDBoundingBox& operator<< (const Vertex& v); }; extern const Vertex g_origin; // Vertex at (0, 0, 0) diff -r ceb1b1aaf7db -r c254ddc6618b src/colorSelector.h --- a/src/colorSelector.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/colorSelector.h Thu Jun 05 23:18:13 2014 +0300 @@ -29,22 +29,22 @@ Q_OBJECT PROPERTY (private, LDColor*, selection, setSelection, STOCK_WRITE) - public: - explicit ColorSelector (int defval = -1, QWidget* parent = null); - virtual ~ColorSelector(); - static bool selectColor (int& val, int defval = -1, QWidget* parent = null); +public: + explicit ColorSelector (int defval = -1, QWidget* parent = null); + virtual ~ColorSelector(); + static bool selectColor (int& val, int defval = -1, QWidget* parent = null); - protected: - void mousePressEvent (QMouseEvent* event); - void resizeEvent (QResizeEvent* ev); +protected: + void mousePressEvent (QMouseEvent* event); + void resizeEvent (QResizeEvent* ev); - private: - Ui_ColorSelUI* ui; - QGraphicsScene* m_scene; - bool m_firstResize; +private: + Ui_ColorSelUI* ui; + QGraphicsScene* m_scene; + bool m_firstResize; - int numRows() const; - int viewportWidth() const; - void drawScene(); - void drawColorInfo(); + int numRows() const; + int viewportWidth() const; + void drawScene(); + void drawColorInfo(); }; diff -r ceb1b1aaf7db -r c254ddc6618b src/colors.h --- a/src/colors.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/colors.h Thu Jun 05 23:18:13 2014 +0300 @@ -24,10 +24,10 @@ class LDColor { - public: - QString name, hexcode; - QColor faceColor, edgeColor; - int index; +public: + QString name, hexcode; + QColor faceColor, edgeColor; + int index; }; void initColors(); diff -r ceb1b1aaf7db -r c254ddc6618b src/configDialog.h --- a/src/configDialog.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/configDialog.h Thu Jun 05 23:18:13 2014 +0300 @@ -30,9 +30,9 @@ PROPERTY (public, KeySequenceConfigEntry*, keyConfig, setKeyConfig, STOCK_WRITE) PROPERTY (public, QAction*, action, setAction, STOCK_WRITE) - public: - explicit ShortcutListItem (QListWidget* view = null, int type = Type) : - QListWidgetItem (view, type) {} +public: + explicit ShortcutListItem (QListWidget* view = null, int type = Type) : + QListWidgetItem (view, type) {} }; // ============================================================================= @@ -40,76 +40,75 @@ { Q_OBJECT - public: - enum Tab - { - InterfaceTab, - EditingToolsTab, - ProfileTab, - ShortcutsTab, - QuickColorsTab, - GridsTab, - ExtProgsTab, - DownloadTab - }; +public: + enum Tab + { + InterfaceTab, + EditingToolsTab, + ProfileTab, + ShortcutsTab, + QuickColorsTab, + GridsTab, + ExtProgsTab, + DownloadTab + }; - explicit ConfigDialog (Tab deftab = InterfaceTab, QWidget* parent = null, Qt::WindowFlags f = 0); - virtual ~ConfigDialog(); + explicit ConfigDialog (Tab deftab = InterfaceTab, QWidget* parent = null, Qt::WindowFlags f = 0); + virtual ~ConfigDialog(); - QList quickColors; + QList quickColors; - private: - Ui_ConfigUI* ui; - QList quickColorItems; +private: + Ui_ConfigUI* ui; + QList quickColorItems; - void applySettings(); - void addShortcut (KeySequenceConfigEntry& cfg, QAction* act, int& i); - void setButtonBackground (QPushButton* button, QString value); - void pickColor (QString& conf, QPushButton* button); - void updateQuickColorList (LDQuickColor* sel = null); - void setShortcutText (ShortcutListItem* item); - int getItemRow (QListWidgetItem* item, QList& haystack); - QString quickColorString(); - QListWidgetItem* getSelectedQuickColor(); - QList getShortcutSelection(); - void initExtProgs(); + void applySettings(); + void addShortcut (KeySequenceConfigEntry& cfg, QAction* act, int& i); + void setButtonBackground (QPushButton* button, QString value); + void pickColor (QString& conf, QPushButton* button); + void updateQuickColorList (LDQuickColor* sel = null); + void setShortcutText (ShortcutListItem* item); + int getItemRow (QListWidgetItem* item, QList& haystack); + QString quickColorString(); + QListWidgetItem* getSelectedQuickColor(); + QList getShortcutSelection(); + void initExtProgs(); - private slots: - void slot_setGLBackground(); - void slot_setGLForeground(); - void slot_setGLSelectColor(); - void slot_setShortcut(); - void slot_resetShortcut(); - void slot_clearShortcut(); - void slot_setColor(); - void slot_delColor(); - void slot_addColorSeparator(); - void slot_moveColor(); - void slot_clearColors(); - void slot_setExtProgPath(); - void slot_findDownloadFolder(); - void buttonClicked (QAbstractButton* button); - void selectPage (int row); +private slots: + void slot_setGLBackground(); + void slot_setGLForeground(); + void slot_setGLSelectColor(); + void slot_setShortcut(); + void slot_resetShortcut(); + void slot_clearShortcut(); + void slot_setColor(); + void slot_delColor(); + void slot_addColorSeparator(); + void slot_moveColor(); + void slot_clearColors(); + void slot_setExtProgPath(); + void slot_findDownloadFolder(); + void buttonClicked (QAbstractButton* button); + void selectPage (int row); }; // ============================================================================= -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -// ============================================================================= +// class KeySequenceDialog : public QDialog { Q_OBJECT - public: - explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0); - static bool staticDialog (KeySequenceConfigEntry* cfg, QWidget* parent = null); +public: + explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0); + static bool staticDialog (KeySequenceConfigEntry* cfg, QWidget* parent = null); - QLabel* lb_output; - QDialogButtonBox* bbx_buttons; - QKeySequence seq; + QLabel* lb_output; + QDialogButtonBox* bbx_buttons; + QKeySequence seq; - private: - void updateOutput(); +private: + void updateOutput(); - private slots: - virtual void keyPressEvent (QKeyEvent* ev) override; +private slots: + virtual void keyPressEvent (QKeyEvent* ev) override; }; diff -r ceb1b1aaf7db -r c254ddc6618b src/configuration.h --- a/src/configuration.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/configuration.h Thu Jun 05 23:18:13 2014 +0300 @@ -47,7 +47,6 @@ QString filepath (QString file); } -// ========================================================= class ConfigEntry { PROPERTY (private, QString, name, setName, STOCK_WRITE) @@ -157,43 +156,31 @@ IMPLEMENT_CONFIG (Int) }; -// ============================================================================= -// class StringConfigEntry : public ConfigEntry { IMPLEMENT_CONFIG (String) }; -// ============================================================================= -// class FloatConfigEntry : public ConfigEntry { IMPLEMENT_CONFIG (Float) }; -// ============================================================================= -// class BoolConfigEntry : public ConfigEntry { IMPLEMENT_CONFIG (Bool) }; -// ============================================================================= -// class KeySequenceConfigEntry : public ConfigEntry { IMPLEMENT_CONFIG (KeySequence) }; -// ============================================================================= -// class ListConfigEntry : public ConfigEntry { IMPLEMENT_CONFIG (List) }; -// ============================================================================= -// class VertexConfigEntry : public ConfigEntry { IMPLEMENT_CONFIG (Vertex) diff -r ceb1b1aaf7db -r c254ddc6618b src/dialogs.h --- a/src/dialogs.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/dialogs.h Thu Jun 05 23:18:13 2014 +0300 @@ -42,26 +42,26 @@ { Q_OBJECT - public: - explicit OverlayDialog (QWidget* parent = null, Qt::WindowFlags f = 0); - virtual ~OverlayDialog(); +public: + explicit OverlayDialog (QWidget* parent = null, Qt::WindowFlags f = 0); + virtual ~OverlayDialog(); - QString fpath() const; - int ofsx() const; - int ofsy() const; - double lwidth() const; - double lheight() const; - int camera() const; + QString fpath() const; + int ofsx() const; + int ofsy() const; + double lwidth() const; + double lheight() const; + int camera() const; - private: - Ui_OverlayUI* ui; - QList> m_cameraArgs; +private: + Ui_OverlayUI* ui; + QList> m_cameraArgs; - private slots: - void slot_fpath(); - void slot_help(); - void slot_dimensionsChanged(); - void fillDefaults (int newcam); +private slots: + void slot_fpath(); + void slot_help(); + void slot_dimensionsChanged(); + void fillDefaults (int newcam); }; // ============================================================================= @@ -69,24 +69,24 @@ { Q_OBJECT - public: - explicit LDrawPathDialog (const bool validDefault, QWidget* parent = null, Qt::WindowFlags f = 0); - virtual ~LDrawPathDialog(); - QString filename() const; - void setPath (QString path); +public: + explicit LDrawPathDialog (const bool validDefault, QWidget* parent = null, Qt::WindowFlags f = 0); + virtual ~LDrawPathDialog(); + QString filename() const; + void setPath (QString path); - private: - Q_DISABLE_COPY (LDrawPathDialog) - const bool m_validDefault; - Ui_LDPathUI* ui; - QPushButton* okButton(); - QPushButton* cancelButton(); +private: + Q_DISABLE_COPY (LDrawPathDialog) + const bool m_validDefault; + Ui_LDPathUI* ui; + QPushButton* okButton(); + QPushButton* cancelButton(); - private slots: - void slot_findPath(); - void slot_tryConfigure(); - void slot_exit(); - void slot_accept(); +private slots: + void slot_findPath(); + void slot_tryConfigure(); + void slot_exit(); + void slot_accept(); }; // ============================================================================= @@ -96,17 +96,17 @@ PROPERTY (public, int, progress, setProgress, STOCK_WRITE) PROPERTY (public, int, numLines, setNumLines, CUSTOM_WRITE) - public: - explicit OpenProgressDialog (QWidget* parent = null, Qt::WindowFlags f = 0); - virtual ~OpenProgressDialog(); +public: + explicit OpenProgressDialog (QWidget* parent = null, Qt::WindowFlags f = 0); + virtual ~OpenProgressDialog(); - public slots: - void updateProgress (int progress); +public slots: + void updateProgress (int progress); - private: - Ui_OpenProgressUI* ui; +private: + Ui_OpenProgressUI* ui; - void updateValues(); + void updateValues(); }; // ============================================================================= @@ -114,16 +114,16 @@ { Q_OBJECT - public: - explicit ExtProgPathPrompt (QString progName, QWidget* parent = 0, Qt::WindowFlags f = 0); - virtual ~ExtProgPathPrompt(); - QString getPath() const; +public: + explicit ExtProgPathPrompt (QString progName, QWidget* parent = 0, Qt::WindowFlags f = 0); + virtual ~ExtProgPathPrompt(); + QString getPath() const; - public slots: - void findPath(); +public slots: + void findPath(); - private: - Ui_ExtProgPath* ui; +private: + Ui_ExtProgPath* ui; }; // ============================================================================= @@ -131,11 +131,11 @@ { Q_OBJECT - public: - AboutDialog (QWidget* parent = null, Qt::WindowFlags f = 0); +public: + AboutDialog (QWidget* parent = null, Qt::WindowFlags f = 0); - private slots: - void slot_mail(); +private slots: + void slot_mail(); }; void bombBox (const QString& message); diff -r ceb1b1aaf7db -r c254ddc6618b src/editHistory.h --- a/src/editHistory.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/editHistory.h Thu Jun 05 23:18:13 2014 +0300 @@ -44,45 +44,45 @@ PROPERTY (public, LDDocumentWeakPtr, document, setDocument, STOCK_WRITE) PROPERTY (public, bool, isIgnoring, setIgnoring, STOCK_WRITE) - public: - typedef QList Changeset; +public: + typedef QList Changeset; - enum EHistoryType - { - EDelHistory, - EEditHistory, - EAddHistory, - EMoveHistory, - ESwapHistory, - }; + enum EHistoryType + { + EDelHistory, + EEditHistory, + EAddHistory, + EMoveHistory, + ESwapHistory, + }; - History(); - void undo(); - void redo(); - void clear(); + History(); + void undo(); + void redo(); + void clear(); - void addStep(); - void add (AbstractHistoryEntry* entry); + void addStep(); + void add (AbstractHistoryEntry* entry); - inline long getSize() const - { - return m_changesets.size(); - } + inline long getSize() const + { + return m_changesets.size(); + } - inline History& operator<< (AbstractHistoryEntry* entry) - { - add (entry); - return *this; - } + inline History& operator<< (AbstractHistoryEntry* entry) + { + add (entry); + return *this; + } - inline const Changeset& getChangeset (long pos) const - { - return m_changesets[pos]; - } + inline const Changeset& getChangeset (long pos) const + { + return m_changesets[pos]; + } - private: - Changeset m_currentChangeset; - QList m_changesets; +private: + Changeset m_currentChangeset; + QList m_changesets; }; // ============================================================================= @@ -91,12 +91,12 @@ { PROPERTY (public, History*, parent, setParent, STOCK_WRITE) - public: - virtual ~AbstractHistoryEntry() {} - virtual void undo() const = 0; - virtual void redo() const = 0; - virtual History::EHistoryType getType() const = 0; - virtual QString getTypeName() const = 0; +public: + virtual ~AbstractHistoryEntry() {} + virtual void undo() const = 0; + virtual void redo() const = 0; + virtual History::EHistoryType getType() const = 0; + virtual QString getTypeName() const = 0; }; // ============================================================================= @@ -106,9 +106,9 @@ PROPERTY (private, int, index, setIndex, STOCK_WRITE) PROPERTY (private, QString, code, setCode, STOCK_WRITE) - public: - IMPLEMENT_HISTORY_TYPE (Del) - DelHistory (int idx, LDObjectPtr obj); +public: + IMPLEMENT_HISTORY_TYPE (Del) + DelHistory (int idx, LDObjectPtr obj); }; // ============================================================================= @@ -119,57 +119,56 @@ PROPERTY (private, QString, oldCode, setOldCode, STOCK_WRITE) PROPERTY (private, QString, newCode, setNewCode, STOCK_WRITE) - public: - IMPLEMENT_HISTORY_TYPE (Edit) +public: + IMPLEMENT_HISTORY_TYPE (Edit) - EditHistory (int idx, QString oldCode, QString newCode) : - m_index (idx), - m_oldCode (oldCode), - m_newCode (newCode) {} + EditHistory (int idx, QString oldCode, QString newCode) : + m_index (idx), + m_oldCode (oldCode), + m_newCode (newCode) {} }; // ============================================================================= -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -// ============================================================================= +// class AddHistory : public AbstractHistoryEntry { PROPERTY (private, int, index, setIndex, STOCK_WRITE) PROPERTY (private, QString, code, setCode, STOCK_WRITE) - public: - IMPLEMENT_HISTORY_TYPE (Add) +public: + IMPLEMENT_HISTORY_TYPE (Add) - AddHistory (int idx, LDObjectPtr obj) : - m_index (idx), - m_code (obj->asText()) {} + AddHistory (int idx, LDObjectPtr obj) : + m_index (idx), + m_code (obj->asText()) {} }; // ============================================================================= // class MoveHistory : public AbstractHistoryEntry { - public: - IMPLEMENT_HISTORY_TYPE (Move) +public: + IMPLEMENT_HISTORY_TYPE (Move) - QList indices; - Vertex dest; + QList indices; + Vertex dest; - MoveHistory (QList indices, Vertex dest) : - indices (indices), - dest (dest) {} + MoveHistory (QList indices, Vertex dest) : + indices (indices), + dest (dest) {} }; // ============================================================================= // class SwapHistory : public AbstractHistoryEntry { - public: - IMPLEMENT_HISTORY_TYPE (Swap) +public: + IMPLEMENT_HISTORY_TYPE (Swap) - SwapHistory (int a, int b) : - a (a), - b (b) {} + SwapHistory (int a, int b) : + a (a), + b (b) {} - private: - int a, b; +private: + int a, b; }; diff -r ceb1b1aaf7db -r c254ddc6618b src/format.h --- a/src/format.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/format.h Thu Jun 05 23:18:13 2014 +0300 @@ -19,74 +19,71 @@ #pragma once #include "basics.h" -//! \file Format.h -//! Contains string formatting-related functions and classes. - -//! -//! Converts a given value into a string that can be retrieved with text(). -//! Used as the argument type to the formatting functions, hence its name. -//! +// +// Converts a given value into a string that can be retrieved with text(). +// Used as the argument type to the formatting functions, hence its name. +// class StringFormatArg { - public: - StringFormatArg (const QString& a) : m_text (a) {} - StringFormatArg (const char& a) : m_text (a) {} - StringFormatArg (const uchar& a) : m_text (a) {} - StringFormatArg (const QChar& a) : m_text (a) {} - StringFormatArg (int a) : m_text (QString::number (a)) {} - StringFormatArg (long a) : m_text (QString::number (a)) {} - StringFormatArg (const float& a) : m_text (QString::number (a)) {} - StringFormatArg (const double& a) : m_text (QString::number (a)) {} - StringFormatArg (const Vertex& a) : m_text (a.toString()) {} - StringFormatArg (const Matrix& a) : m_text (a.toString()) {} - StringFormatArg (const char* a) : m_text (a) {} +public: + StringFormatArg (const QString& a) : m_text (a) {} + StringFormatArg (const char& a) : m_text (a) {} + StringFormatArg (const uchar& a) : m_text (a) {} + StringFormatArg (const QChar& a) : m_text (a) {} + StringFormatArg (int a) : m_text (QString::number (a)) {} + StringFormatArg (long a) : m_text (QString::number (a)) {} + StringFormatArg (const float& a) : m_text (QString::number (a)) {} + StringFormatArg (const double& a) : m_text (QString::number (a)) {} + StringFormatArg (const Vertex& a) : m_text (a.toString()) {} + StringFormatArg (const Matrix& a) : m_text (a.toString()) {} + StringFormatArg (const char* a) : m_text (a) {} + + StringFormatArg (const void* a) + { + m_text.sprintf ("%p", a); + } - StringFormatArg (const void* a) - { - m_text.sprintf ("%p", a); - } + template + StringFormatArg (QSharedPointer const& a) + { + m_text.sprintf ("%p", a.data()); + } + + template + StringFormatArg (QWeakPointer const& a) + { + m_text.sprintf ("%p", a.data()); + } - template - StringFormatArg (QSharedPointer const& a) + template + StringFormatArg (const QList& a) + { + m_text = "{"; + + for (const T& it : a) { - m_text.sprintf ("%p", a.data()); + if (&it != &a.first()) + m_text += ", "; + + StringFormatArg arg (it); + m_text += arg.text(); } - template - StringFormatArg (QWeakPointer const& a) - { - m_text.sprintf ("%p", a.data()); - } - - template - StringFormatArg (const QList& a) - { - m_text = "{"; + m_text += "}"; + } - for (const T& it : a) - { - if (&it != &a.first()) - m_text += ", "; - - StringFormatArg arg (it); - m_text += arg.text(); - } + inline QString text() const + { + return m_text; + } - m_text += "}"; - } - - inline QString text() const - { - return m_text; - } - - private: - QString m_text; +private: + QString m_text; }; -//! -//! Helper function for \c format -//! +// +// Helper function for \c format +// template void formatHelper (QString& str, Arg1 arg1, Rest... rest) { @@ -94,26 +91,22 @@ formatHelper (str, rest...); } -//! -//! Overload of \c formatHelper() with no template args -//! +// +// Overload of \c formatHelper() with no template args +// static void formatHelper (QString& str) __attribute__ ((unused)); static void formatHelper (QString& str) { (void) str; } -//! -//! @brief Format the message with the given args. -//! -//! The formatting ultimately uses String's arg() method to actually format -//! the args so the format string should be prepared accordingly, with %1 -//! referring to the first arg, %2 to the second, etc. -//! -//! \param fmtstr The string to format -//! \param args The args to format with -//! \return The formatted string -//! +// +// Format the message with the given args. +// +// The formatting ultimately uses String's arg() method to actually format +// the args so the format string should be prepared accordingly, with %1 +// referring to the first arg, %2 to the second, etc. +// template QString format (QString fmtstr, Args... args) { @@ -121,17 +114,15 @@ return fmtstr; } -//! -//! From MessageLog.cc - declared here so that I don't need to include -//! messageLog.h here. Prints the given message to log. -//! +// +// From messageLog.cc - declared here so that I don't need to include +// messageLog.h here. Prints the given message to log. +// void printToLog (const QString& msg); -//! -//! Format and print the given args to the message log. -//! \param fmtstr The string to format -//! \param args The args to format with -//! +// +// Format and print the given args to the message log. +// template void print (QString fmtstr, Args... args) { @@ -139,12 +130,9 @@ printToLog (fmtstr); } -//! -//! Format and print the given args to the given file descriptor -//! \param fp The file descriptor to print to -//! \param fmtstr The string to format -//! \param args The args to format with -//! +// +// Format and print the given args to the given file descriptor +// template void fprint (FILE* fp, QString fmtstr, Args... args) { @@ -152,12 +140,9 @@ fprintf (fp, "%s", qPrintable (fmtstr)); } -//! -//! Overload of \c fprint with a QIODevice -//! \param dev The IO device to print to -//! \param fmtstr The string to format -//! \param args The args to format with -//! +// +// Overload of fprint with a QIODevice +// template void fprint (QIODevice& dev, QString fmtstr, Args... args) { @@ -165,19 +150,16 @@ dev.write (fmtstr.toUtf8()); } -//! -//! Exactly like print() except no-op in release builds. -//! \param fmtstr The string to format -//! \param args The args to format with -//! +// +// Exactly like print() except no-op in release builds. +// template +#ifndef RELEASE void dprint (QString fmtstr, Args... args) { -#ifndef RELEASE formatHelper (fmtstr, args...); printToLog (fmtstr); +} #else - (void) fmtstr; - (void) args; +void dprint (QString, Args...) {} #endif -} diff -r ceb1b1aaf7db -r c254ddc6618b src/ldDocument.h --- a/src/ldDocument.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/ldDocument.h Thu Jun 05 23:18:13 2014 +0300 @@ -62,120 +62,120 @@ // class LDDocument : public QObject { - public: - using KnownVertexMap = QMap; +public: + using KnownVertexMap = QMap; - PROPERTY (public, QString, name, setName, STOCK_WRITE) - PROPERTY (private, LDObjectList, objects, setObjects, STOCK_WRITE) - PROPERTY (private, LDObjectList, cache, setCache, STOCK_WRITE) - PROPERTY (private, History*, history, setHistory, STOCK_WRITE) - PROPERTY (private, KnownVertexMap, vertices, setVertices, STOCK_WRITE) - PROPERTY (public, QString, fullPath, setFullPath, STOCK_WRITE) - PROPERTY (public, QString, defaultName, setDefaultName, STOCK_WRITE) - PROPERTY (public, bool, isImplicit, setImplicit, CUSTOM_WRITE) - PROPERTY (public, long, savePosition, setSavePosition, STOCK_WRITE) - PROPERTY (public, int, tabIndex, setTabIndex, STOCK_WRITE) - PROPERTY (public, QList, polygonData, setPolygonData, STOCK_WRITE) - PROPERTY (private, LDDocumentFlags, flags, setFlags, STOCK_WRITE) - PROPERTY (private, LDDocumentWeakPtr, self, setSelf, STOCK_WRITE) + PROPERTY (public, QString, name, setName, STOCK_WRITE) + PROPERTY (private, LDObjectList, objects, setObjects, STOCK_WRITE) + PROPERTY (private, LDObjectList, cache, setCache, STOCK_WRITE) + PROPERTY (private, History*, history, setHistory, STOCK_WRITE) + PROPERTY (private, KnownVertexMap, vertices, setVertices, STOCK_WRITE) + PROPERTY (public, QString, fullPath, setFullPath, STOCK_WRITE) + PROPERTY (public, QString, defaultName, setDefaultName, STOCK_WRITE) + PROPERTY (public, bool, isImplicit, setImplicit, CUSTOM_WRITE) + PROPERTY (public, long, savePosition, setSavePosition, STOCK_WRITE) + PROPERTY (public, int, tabIndex, setTabIndex, STOCK_WRITE) + PROPERTY (public, QList, polygonData, setPolygonData, STOCK_WRITE) + PROPERTY (private, LDDocumentFlags, flags, setFlags, STOCK_WRITE) + PROPERTY (private, LDDocumentWeakPtr, self, setSelf, STOCK_WRITE) - public: - LDDocument(LDDocumentPtr* selfptr); - ~LDDocument(); +public: + LDDocument(LDDocumentPtr* selfptr); + ~LDDocument(); - int addObject (LDObjectPtr obj); // Adds an object to this file at the end of the file. - void addObjects (const LDObjectList objs); - void clearSelection(); - void forgetObject (LDObjectPtr obj); // Deletes the given object from the object chain. - QString getDisplayName(); - const LDObjectList& getSelection() const; - bool hasUnsavedChanges() const; // Does this document have unsaved changes? - void initializeCachedData(); - LDObjectList inlineContents (bool deep, bool renderinline); - void insertObj (int pos, LDObjectPtr obj); - int getObjectCount() const; - LDObjectPtr getObject (int pos) const; - bool save (QString path = ""); // Saves this file to disk. - void swapObjects (LDObjectPtr one, LDObjectPtr other); - bool isSafeToClose(); // Perform safety checks. Do this before closing any files! - void setObject (int idx, LDObjectPtr obj); - QList inlinePolygons(); - void vertexChanged (const Vertex& a, const Vertex& b); - void addKnownVerticesOf(LDObjectPtr obj); - void removeKnownVerticesOf (LDObjectPtr sub); - QList inlineVertices(); - void clear(); + int addObject (LDObjectPtr obj); // Adds an object to this file at the end of the file. + void addObjects (const LDObjectList objs); + void clearSelection(); + void forgetObject (LDObjectPtr obj); // Deletes the given object from the object chain. + QString getDisplayName(); + const LDObjectList& getSelection() const; + bool hasUnsavedChanges() const; // Does this document have unsaved changes? + void initializeCachedData(); + LDObjectList inlineContents (bool deep, bool renderinline); + void insertObj (int pos, LDObjectPtr obj); + int getObjectCount() const; + LDObjectPtr getObject (int pos) const; + bool save (QString path = ""); // Saves this file to disk. + void swapObjects (LDObjectPtr one, LDObjectPtr other); + bool isSafeToClose(); // Perform safety checks. Do this before closing any files! + void setObject (int idx, LDObjectPtr obj); + QList inlinePolygons(); + void vertexChanged (const Vertex& a, const Vertex& b); + void addKnownVerticesOf(LDObjectPtr obj); + void removeKnownVerticesOf (LDObjectPtr sub); + QList inlineVertices(); + void clear(); - inline LDDocument& operator<< (LDObjectPtr obj) - { - addObject (obj); - return *this; - } + inline LDDocument& operator<< (LDObjectPtr obj) + { + addObject (obj); + return *this; + } - inline void addHistoryStep() - { - history()->addStep(); - } + inline void addHistoryStep() + { + history()->addStep(); + } - inline void undo() - { - history()->undo(); - } + inline void undo() + { + history()->undo(); + } - inline void redo() - { - history()->redo(); - } + inline void redo() + { + history()->redo(); + } - inline void clearHistory() - { - history()->clear(); - } + inline void clearHistory() + { + history()->clear(); + } - inline void addToHistory (AbstractHistoryEntry* entry) - { - *history() << entry; - } + inline void addToHistory (AbstractHistoryEntry* entry) + { + *history() << entry; + } - inline void dismiss() - { - setImplicit (true); - } + inline void dismiss() + { + setImplicit (true); + } - static void closeUnused(); - static LDDocumentPtr current(); - static void setCurrent (LDDocumentPtr f); - static void closeInitialFile(); - static int countExplicitFiles(); - static LDDocumentPtr createNew(); + static void closeUnused(); + static LDDocumentPtr current(); + static void setCurrent (LDDocumentPtr f); + static void closeInitialFile(); + static int countExplicitFiles(); + static LDDocumentPtr createNew(); - // Turns a full path into a relative path - static QString shortenName (QString a); - static QList const& explicitDocuments(); + // Turns a full path into a relative path + static QString shortenName (QString a); + static QList const& explicitDocuments(); - protected: - void addToSelection (LDObjectPtr obj); - void removeFromSelection (LDObjectPtr obj); +protected: + void addToSelection (LDObjectPtr obj); + void removeFromSelection (LDObjectPtr obj); - LDGLData* getGLData() - { - return m_gldata; - } + LDGLData* getGLData() + { + return m_gldata; + } - friend class LDObject; - friend class GLRenderer; + friend class LDObject; + friend class GLRenderer; - private: - LDObjectList m_sel; - LDGLData* m_gldata; - QList m_storedVertices; +private: + LDObjectList m_sel; + LDGLData* m_gldata; + QList m_storedVertices; - // If set to true, next polygon inline of this document discards the - // stored polygon data and re-builds it. - bool m_needsReCache; + // If set to true, next polygon inline of this document discards the + // stored polygon data and re-builds it. + bool m_needsReCache; - void addKnownVertexReference (const Vertex& a); - void removeKnownVertexReference (const Vertex& a); + void addKnownVertexReference (const Vertex& a); + void removeKnownVertexReference (const Vertex& a); }; inline LDDocumentPtr getCurrentDocument() diff -r ceb1b1aaf7db -r c254ddc6618b src/mainWindow.h --- a/src/mainWindow.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/mainWindow.h Thu Jun 05 23:18:13 2014 +0300 @@ -68,9 +68,9 @@ static LDQuickColor getSeparator(); }; -//! -//! Object list class for MainWindow -//! +// +// Object list class for MainWindow +// class ObjectList : public QListWidget { Q_OBJECT @@ -79,242 +79,233 @@ void contextMenuEvent (QContextMenuEvent* ev); }; -//! -//! \brief The main window class. -//! -//! The MainWindow is LDForge's main GUI. It hosts the renderer, the object list, -//! the message log, etc. Contains \c slot_action(), which is what all actions -//! connect to. -//! +// +// LDForge's main GUI class. +// class MainWindow : public QMainWindow { - Q_OBJECT - - public: - //! Constructs the main window - explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0); +Q_OBJECT - //! Rebuilds the object list, located to the right of the GUI. - void buildObjList(); +public: + explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0); - //! Updates the window title. - void updateTitle(); + // Rebuilds the object list. + void buildObjList(); - //! Builds the object list and tells the GL renderer to init a full - //! refresh. - void doFullRefresh(); + // Updates the window title. + void updateTitle(); - //! Builds the object list and tells the GL renderer to do a soft update. - void refresh(); + // Builds the object list and tells the GL renderer to init a full + // refresh. + void doFullRefresh(); - //! \returns the suggested position to place a new object at. - int getInsertionPoint(); + // Builds the object list and tells the GL renderer to do a soft update. + void refresh(); - //! Updates the quick color toolbar - void updateColorToolbar(); + // Returns the suggested position to place a new object at. + int getInsertionPoint(); - //! Rebuilds the recent files submenu - void updateRecentFilesMenu(); + // Updates the quick color toolbar + void updateColorToolbar(); - //! Sets the selection based on what's selected in the object list. - void updateSelection(); + // Rebuilds the recent files submenu + void updateRecentFilesMenu(); - //! Updates the grids, selects the selected grid and deselects others. - void updateGridToolBar(); + // Sets the selection based on what's selected in the object list. + void updateSelection(); - //! Updates the edit modes, current one is selected and others are deselected. - void updateEditModeActions(); + // Updates the grids, selects the selected grid and deselects others. + void updateGridToolBar(); - //! Rebuilds the document tab list. - void updateDocumentList(); + // Updates the edit modes, current one is selected and others are deselected. + void updateEditModeActions(); - //! Updates the document tab for \c doc. If no such tab exists, the - //! document list is rebuilt instead. - void updateDocumentListItem (LDDocumentPtr doc); + // Rebuilds the document tab list. + void updateDocumentList(); - //! \returns the uniform selected color (i.e. 4 if everything selected is - //! red), -1 if there is no such consensus. - int getSelectedColor(); + // Updates the document tab for \c doc. If no such tab exists, the + // document list is rebuilt instead. + void updateDocumentListItem (LDDocumentPtr doc); - //! Automatically scrolls the object list so that it points to the first - //! selected object. - void scrollToSelection(); + // Returns the uniform selected color (i.e. 4 if everything selected is + // red), -1 if there is no such consensus. + int getSelectedColor(); - //! Spawns the context menu at the given position. - void spawnContextMenu (const QPoint pos); + // Automatically scrolls the object list so that it points to the first + // selected object. + void scrollToSelection(); - //! Deletes all selected objects. - //! \returns the count of deleted objects. - int deleteSelection(); + // Spawns the context menu at the given position. + void spawnContextMenu (const QPoint pos); - //! Deletes all objects by the given color number. - void deleteByColor (int colnum); + // Deletes all selected objects, returns the count of deleted objects. + int deleteSelection(); + + // Deletes all objects by the given color number. + void deleteByColor (int colnum); - //! Tries to save the given document. - //! \param doc the document to save - //! \param saveAs if true, always ask for a file path - //! \returns whether the save was successful - bool save (LDDocumentPtr doc, bool saveAs); + // Tries to save the given document. + bool save (LDDocumentPtr doc, bool saveAs); - //! Updates various actions, undo/redo are set enabled/disabled where - //! appropriate, togglable actions are updated based on configuration, - //! etc. - void updateActions(); + // Updates various actions, undo/redo are set enabled/disabled where + // appropriate, togglable actions are updated based on configuration, + // etc. + void updateActions(); - //! \returns a pointer to the renderer - inline GLRenderer* R() - { - return m_renderer; - } + // Returns a pointer to the renderer + inline GLRenderer* R() + { + return m_renderer; + } - //! Sets the quick color list to the given list of colors. - inline void setQuickColors (const QList& colors) - { - m_quickColors = colors; - updateColorToolbar(); - } + // Sets the quick color list to the given list of colors. + inline void setQuickColors (const QList& colors) + { + m_quickColors = colors; + updateColorToolbar(); + } - //! Adds a message to the renderer's message manager. - void addMessage (QString msg); + // Adds a message to the renderer's message manager. + void addMessage (QString msg); - //! Updates the object list. Right now this just rebuilds it. - void refreshObjectList(); + // Updates the object list. Right now this just rebuilds it. + void refreshObjectList(); - //! Updates all actions to ensure they have the correct shortcut as - //! defined in the configuration entries. - void updateActionShortcuts(); + // Updates all actions to ensure they have the correct shortcut as + // defined in the configuration entries. + void updateActionShortcuts(); - //! Gets the shortcut configuration for the given \c action - KeySequenceConfigEntry* shortcutForAction (QAction* action); + // Gets the shortcut configuration for the given \c action + KeySequenceConfigEntry* shortcutForAction (QAction* action); - void endAction(); + void endAction(); - inline QTreeWidget* getPrimitivesTree() const - { - return ui->primitives; - } + inline QTreeWidget* getPrimitivesTree() const + { + return ui->primitives; + } - public slots: - void updatePrimitives(); - void changeCurrentFile(); - void slot_action(); - void slot_actionNew(); - void slot_actionNewFile(); - void slot_actionOpen(); - void slot_actionDownloadFrom(); - void slot_actionSave(); - void slot_actionSaveAs(); - void slot_actionSaveAll(); - void slot_actionClose(); - void slot_actionCloseAll(); - void slot_actionInsertFrom(); - void slot_actionExportTo(); - void slot_actionSettings(); - void slot_actionSetLDrawPath(); - void slot_actionScanPrimitives(); - void slot_actionExit(); - void slot_actionResetView(); - void slot_actionAxes(); - void slot_actionWireframe(); - void slot_actionBFCView(); - void slot_actionSetOverlay(); - void slot_actionClearOverlay(); - void slot_actionScreenshot(); - void slot_actionInsertRaw(); - void slot_actionNewSubfile(); - void slot_actionNewLine(); - void slot_actionNewTriangle(); - void slot_actionNewQuad(); - void slot_actionNewCLine(); - void slot_actionNewComment(); - void slot_actionNewBFC(); - void slot_actionNewVertex(); - void slot_actionUndo(); - void slot_actionRedo(); - void slot_actionCut(); - void slot_actionCopy(); - void slot_actionPaste(); - void slot_actionDelete(); - void slot_actionSelectAll(); - void slot_actionSelectByColor(); - void slot_actionSelectByType(); - void slot_actionModeDraw(); - void slot_actionModeSelect(); - void slot_actionModeCircle(); - void slot_actionSetDrawDepth(); - void slot_actionSetColor(); - void slot_actionAutocolor(); - void slot_actionUncolor(); - void slot_actionInline(); - void slot_actionInlineDeep(); - void slot_actionInvert(); - void slot_actionMakePrimitive(); - void slot_actionSplitQuads(); - void slot_actionEditRaw(); - void slot_actionBorders(); - void slot_actionCornerVerts(); - void slot_actionRoundCoordinates(); - void slot_actionVisibilityHide(); - void slot_actionVisibilityReveal(); - void slot_actionVisibilityToggle(); - void slot_actionReplaceCoords(); - void slot_actionFlip(); - void slot_actionDemote(); - void slot_actionYtruder(); - void slot_actionRectifier(); - void slot_actionIntersector(); - void slot_actionIsecalc(); - void slot_actionCoverer(); - void slot_actionEdger2(); - void slot_actionHelp(); - void slot_actionAbout(); - void slot_actionAboutQt(); - void slot_actionGridCoarse(); - void slot_actionGridMedium(); - void slot_actionGridFine(); - void slot_actionEdit(); - void slot_actionMoveUp(); - void slot_actionMoveDown(); - void slot_actionMoveXNeg(); - void slot_actionMoveXPos(); - void slot_actionMoveYNeg(); - void slot_actionMoveYPos(); - void slot_actionMoveZNeg(); - void slot_actionMoveZPos(); - void slot_actionRotateXNeg(); - void slot_actionRotateXPos(); - void slot_actionRotateYNeg(); - void slot_actionRotateYPos(); - void slot_actionRotateZNeg(); - void slot_actionRotateZPos(); - void slot_actionRotationPoint(); - void slot_actionAddHistoryLine(); - void slot_actionJumpTo(); - void slot_actionSubfileSelection(); - void slot_actionDrawAngles(); - void slot_actionRandomColors(); - void slot_actionOpenSubfiles(); +public slots: + void updatePrimitives(); + void changeCurrentFile(); + void slot_action(); + void slot_actionNew(); + void slot_actionNewFile(); + void slot_actionOpen(); + void slot_actionDownloadFrom(); + void slot_actionSave(); + void slot_actionSaveAs(); + void slot_actionSaveAll(); + void slot_actionClose(); + void slot_actionCloseAll(); + void slot_actionInsertFrom(); + void slot_actionExportTo(); + void slot_actionSettings(); + void slot_actionSetLDrawPath(); + void slot_actionScanPrimitives(); + void slot_actionExit(); + void slot_actionResetView(); + void slot_actionAxes(); + void slot_actionWireframe(); + void slot_actionBFCView(); + void slot_actionSetOverlay(); + void slot_actionClearOverlay(); + void slot_actionScreenshot(); + void slot_actionInsertRaw(); + void slot_actionNewSubfile(); + void slot_actionNewLine(); + void slot_actionNewTriangle(); + void slot_actionNewQuad(); + void slot_actionNewCLine(); + void slot_actionNewComment(); + void slot_actionNewBFC(); + void slot_actionNewVertex(); + void slot_actionUndo(); + void slot_actionRedo(); + void slot_actionCut(); + void slot_actionCopy(); + void slot_actionPaste(); + void slot_actionDelete(); + void slot_actionSelectAll(); + void slot_actionSelectByColor(); + void slot_actionSelectByType(); + void slot_actionModeDraw(); + void slot_actionModeSelect(); + void slot_actionModeCircle(); + void slot_actionSetDrawDepth(); + void slot_actionSetColor(); + void slot_actionAutocolor(); + void slot_actionUncolor(); + void slot_actionInline(); + void slot_actionInlineDeep(); + void slot_actionInvert(); + void slot_actionMakePrimitive(); + void slot_actionSplitQuads(); + void slot_actionEditRaw(); + void slot_actionBorders(); + void slot_actionCornerVerts(); + void slot_actionRoundCoordinates(); + void slot_actionVisibilityHide(); + void slot_actionVisibilityReveal(); + void slot_actionVisibilityToggle(); + void slot_actionReplaceCoords(); + void slot_actionFlip(); + void slot_actionDemote(); + void slot_actionYtruder(); + void slot_actionRectifier(); + void slot_actionIntersector(); + void slot_actionIsecalc(); + void slot_actionCoverer(); + void slot_actionEdger2(); + void slot_actionHelp(); + void slot_actionAbout(); + void slot_actionAboutQt(); + void slot_actionGridCoarse(); + void slot_actionGridMedium(); + void slot_actionGridFine(); + void slot_actionEdit(); + void slot_actionMoveUp(); + void slot_actionMoveDown(); + void slot_actionMoveXNeg(); + void slot_actionMoveXPos(); + void slot_actionMoveYNeg(); + void slot_actionMoveYPos(); + void slot_actionMoveZNeg(); + void slot_actionMoveZPos(); + void slot_actionRotateXNeg(); + void slot_actionRotateXPos(); + void slot_actionRotateYNeg(); + void slot_actionRotateYPos(); + void slot_actionRotateZNeg(); + void slot_actionRotateZPos(); + void slot_actionRotationPoint(); + void slot_actionAddHistoryLine(); + void slot_actionJumpTo(); + void slot_actionSubfileSelection(); + void slot_actionDrawAngles(); + void slot_actionRandomColors(); + void slot_actionOpenSubfiles(); - protected: - void closeEvent (QCloseEvent* ev); +protected: + void closeEvent (QCloseEvent* ev); - private: - GLRenderer* m_renderer; - LDObjectList m_sel; - QList m_quickColors; - QList m_colorButtons; - QList m_recentFiles; - MessageManager* m_msglog; - Ui_LDForgeUI* ui; - QTabBar* m_tabs; - bool m_updatingTabs; +private: + GLRenderer* m_renderer; + LDObjectList m_sel; + QList m_quickColors; + QList m_colorButtons; + QList m_recentFiles; + MessageManager* m_msglog; + Ui_LDForgeUI* ui; + QTabBar* m_tabs; + bool m_updatingTabs; - private slots: - void slot_selectionChanged(); - void slot_recentFile(); - void slot_quickColor(); - void slot_lastSecondCleanup(); - void slot_editObject (QListWidgetItem* listitem); +private slots: + void slot_selectionChanged(); + void slot_recentFile(); + void slot_quickColor(); + void slot_lastSecondCleanup(); + void slot_editObject (QListWidgetItem* listitem); }; //! Pointer to the instance of MainWindow. diff -r ceb1b1aaf7db -r c254ddc6618b src/messageLog.h --- a/src/messageLog.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/messageLog.h Thu Jun 05 23:18:13 2014 +0300 @@ -25,60 +25,56 @@ class GLRenderer; class QTimer; -//! -//! \brief Manages the list of messages at the top-left of the renderer. -//! -//! The message manager is an object which keeps track of messages that appear -//! on the renderer's screen. Each line is contained in a separate object which -//! contains the text, expiry time and alpha. The message manager is doubly -//! linked to its corresponding renderer. -//! -//! Message manager calls its \c tick() function regularly to update the messages, -//! where each line's expiry is checked for. Lines begin to fade out when nearing -//! their expiry. If the message manager's lines change, the renderer undergoes -//! repainting. -//! +// +// The message manager is an object which keeps track of messages that appear +// on the renderer's screen. Each line is contained in a separate object which +// contains the text, expiry time and alpha. The message manager is doubly +// linked to its corresponding renderer. +// +// Message manager calls its tick() function regularly to update the messages, +// where each line's expiry is checked for. Lines begin to fade out when nearing +// their expiry. If the message manager's lines change, the renderer undergoes +// repainting. +// class MessageManager : public QObject { - Q_OBJECT - PROPERTY (public, GLRenderer*, renderer, setRenderer, STOCK_WRITE) +Q_OBJECT +PROPERTY (public, GLRenderer*, renderer, setRenderer, STOCK_WRITE) - public: - //! \class MessageManager::Line - //! A single line of the message log. - class Line - { - public: - //! Constructs a line with the given \c text - Line (QString text); +public: + // A single line of the message log. + class Line + { + public: + // Constructs a line with the given \c text + Line (QString text); - //! Check this line's expiry and update alpha accordingly. - //! \c changed is updated to whether the line has somehow - //! changed since the last update. - //! \returns true if the line is to still stick around, false - //! \returns if it expired. - bool update (bool& changed); + // Check this line's expiry and update alpha accordingly. @changed + // is updated to whether the line has somehow changed since the + // last update. + // + // Returns true if the line is to still stick around, false if it + // expired. + bool update (bool& changed); - QString text; - float alpha; - QDateTime expiry; - }; + QString text; + float alpha; + QDateTime expiry; + }; - //! Constructs the message manager. - explicit MessageManager (QObject* parent = null); + // Constructs the message manager. + explicit MessageManager (QObject* parent = null); - //! Adds a line with the given \c text to the message manager. - void addLine (QString line); + // Adds a line with the given \c text to the message manager. + void addLine (QString line); - //! \returns all active lines in the message manager. - const QList& getLines() const; + // Returns all active lines in the message manager. + const QList& getLines() const; - private: - QList m_lines; - QTimer* m_ticker; +private: + QList m_lines; + QTimer* m_ticker; - private slots: - //! Ticks the manager. This is called by the timer to update - //! the messages. - void tick(); +private slots: + void tick(); }; diff -r ceb1b1aaf7db -r c254ddc6618b src/miscallenous.h --- a/src/miscallenous.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/miscallenous.h Thu Jun 05 23:18:13 2014 +0300 @@ -51,9 +51,9 @@ // Grid stuff struct gridinfo { - const char* const name; - ConfigEntry::FloatType* const coordsnap; - ConfigEntry::FloatType* const anglesnap; + const char* name; + ConfigEntry::FloatType* coordsnap; + ConfigEntry::FloatType* anglesnap; }; EXTERN_CFGENTRY (Int, grid); diff -r ceb1b1aaf7db -r c254ddc6618b src/partDownloader.h --- a/src/partDownloader.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/partDownloader.h Thu Jun 05 23:18:13 2014 +0300 @@ -35,53 +35,53 @@ // class PartDownloader : public QDialog { - public: - enum Source - { - PartsTracker, - CustomURL, - }; +public: + enum Source + { + PartsTracker, + CustomURL, + }; - enum Button - { - Download, - Abort, - Close - }; + enum Button + { + Download, + Abort, + Close + }; - enum TableColumn - { - PartLabelColumn, - ProgressColumn, - }; + enum TableColumn + { + PartLabelColumn, + ProgressColumn, + }; - using RequestList = QList; + using RequestList = QList; - Q_OBJECT - PROPERTY (public, LDDocumentPtr, primaryFile, setPrimaryFile, STOCK_WRITE) - PROPERTY (public, bool, isAborted, setAborted, STOCK_WRITE) - PROPERTY (private, Ui_DownloadFrom*, interface, setInterface, STOCK_WRITE) - PROPERTY (private, QStringList, filesToDownload, setFilesToDownload, STOCK_WRITE) - PROPERTY (private, RequestList, requests, setRequests, STOCK_WRITE) - PROPERTY (private, QPushButton*, downloadButton, setDownloadButton, STOCK_WRITE) + Q_OBJECT + PROPERTY (public, LDDocumentPtr, primaryFile, setPrimaryFile, STOCK_WRITE) + PROPERTY (public, bool, isAborted, setAborted, STOCK_WRITE) + PROPERTY (private, Ui_DownloadFrom*, interface, setInterface, STOCK_WRITE) + PROPERTY (private, QStringList, filesToDownload, setFilesToDownload, STOCK_WRITE) + PROPERTY (private, RequestList, requests, setRequests, STOCK_WRITE) + PROPERTY (private, QPushButton*, downloadButton, setDownloadButton, STOCK_WRITE) - public: - explicit PartDownloader (QWidget* parent = null); - virtual ~PartDownloader(); +public: + explicit PartDownloader (QWidget* parent = null); + virtual ~PartDownloader(); - void downloadFile (QString dest, QString url, bool primary); - QPushButton* getButton (Button i); - QString getURL() const; - Source getSource() const; - void modifyDestination (QString& dest) const; + void downloadFile (QString dest, QString url, bool primary); + QPushButton* getButton (Button i); + QString getURL() const; + Source getSource() const; + void modifyDestination (QString& dest) const; - static QString getDownloadPath(); - static void staticBegin(); + static QString getDownloadPath(); + static void staticBegin(); - public slots: - void buttonClicked (QAbstractButton* btn); - void checkIfFinished(); - void sourceChanged (int i); +public slots: + void buttonClicked (QAbstractButton* btn); + void checkIfFinished(); + void sourceChanged (int i); }; // ============================================================================= diff -r ceb1b1aaf7db -r c254ddc6618b src/primitives.h --- a/src/primitives.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/primitives.h Thu Jun 05 23:18:13 2014 +0300 @@ -25,10 +25,11 @@ class LDDocument; class Ui_MakePrimUI; class PrimitiveCategory; + struct Primitive { - QString name, - title; + QString name; + QString title; PrimitiveCategory* category; }; @@ -37,32 +38,29 @@ Q_OBJECT PROPERTY (public, QString, name, setName, STOCK_WRITE) - public: - enum RegexType - { - EFilenameRegex, - ETitleRegex - }; +public: + enum RegexType + { + EFilenameRegex, + ETitleRegex + }; - struct RegexEntry - { - QRegExp regex; - RegexType type; - }; + struct RegexEntry + { + QRegExp regex; + RegexType type; + }; - QList regexes; - QList prims; + QList regexes; + QList prims; - explicit PrimitiveCategory (QString name, QObject* parent = 0); - bool isValidToInclude(); + explicit PrimitiveCategory (QString name, QObject* parent = 0); + bool isValidToInclude(); - static void loadCategories(); - static void populateCategories(); + static void loadCategories(); + static void populateCategories(); }; -// ============================================================================= -// -// PrimitiveScanner // // Worker object that scans the primitives folder for primitives and // builds an index of them. @@ -71,24 +69,24 @@ { Q_OBJECT - public: - explicit PrimitiveScanner (QObject* parent = 0); - virtual ~PrimitiveScanner(); - static void start(); +public: + explicit PrimitiveScanner (QObject* parent = 0); + virtual ~PrimitiveScanner(); + static void start(); - public slots: - void work(); +public slots: + void work(); - signals: - void starting (int num); - void workDone(); - void update (int i); +signals: + void starting (int num); + void workDone(); + void update (int i); - private: - QList m_prims; - QStringList m_files; - int m_i; - int m_baselen; +private: + QList m_prims; + QStringList m_files; + int m_i; + int m_baselen; }; extern QList g_PrimitiveCategories; @@ -106,18 +104,17 @@ Cone, }; -// ============================================================================= class PrimitivePrompt : public QDialog { Q_OBJECT - public: - explicit PrimitivePrompt (QWidget* parent = null, Qt::WindowFlags f = 0); - virtual ~PrimitivePrompt(); - Ui_MakePrimUI* ui; +public: + explicit PrimitivePrompt (QWidget* parent = null, Qt::WindowFlags f = 0); + virtual ~PrimitivePrompt(); + Ui_MakePrimUI* ui; - public slots: - void hiResToggled (bool on); +public slots: + void hiResToggled (bool on); }; void makeCircle (int segs, int divs, double radius, QList& lines); diff -r ceb1b1aaf7db -r c254ddc6618b src/radioGroup.h --- a/src/radioGroup.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/radioGroup.h Thu Jun 05 23:18:13 2014 +0300 @@ -29,64 +29,62 @@ class QBoxLayout; class QRadioButton; -// ============================================================================= -// RadioGroup // // Convenience widget - is a groupbox of radio buttons. -// ============================================================================= +// class RadioGroup : public QGroupBox { Q_OBJECT - public: - typedef QList::Iterator Iterator; +public: + typedef QList::Iterator Iterator; - explicit RadioGroup() - { - init (Qt::Vertical); - } + explicit RadioGroup() + { + init (Qt::Vertical); + } - explicit RadioGroup (QWidget* parent = null) : QGroupBox (parent) - { - init (Qt::Vertical); - } + explicit RadioGroup (QWidget* parent = null) : QGroupBox (parent) + { + init (Qt::Vertical); + } - explicit RadioGroup (const QString& title, QWidget* parent = null); - explicit RadioGroup (const QString& title, QList entries, int const defaultId, - const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null); + explicit RadioGroup (const QString& title, QWidget* parent = null); + explicit RadioGroup (const QString& title, QList entries, int const defaultId, + const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null); - void addButton (const char* entry); - void addButton (QRadioButton* button); - Iterator begin(); - Iterator end(); - void init (Qt::Orientation orient); - bool isChecked (int n) const; - void rowBreak(); - void setCurrentRow (int row); - void setValue (int val); - int value() const; + void addButton (const char* entry); + void addButton (QRadioButton* button); + Iterator begin(); + Iterator end(); + void init (Qt::Orientation orient); + bool isChecked (int n) const; + void rowBreak(); + void setCurrentRow (int row); + void setValue (int val); + int value() const; - QRadioButton* operator[] (int n) const; - RadioGroup& operator<< (QRadioButton* button); - RadioGroup& operator<< (const char* entry); + QRadioButton* operator[] (int n) const; + RadioGroup& operator<< (QRadioButton* button); + RadioGroup& operator<< (const char* entry); - signals: - void buttonPressed (int btn); - void buttonReleased (int btn); - void valueChanged (int val); +signals: + void buttonPressed (int btn); + void buttonReleased (int btn); + void valueChanged (int val); - private: - QList m_objects; - QList m_layouts; - QBoxLayout* m_coreLayout; - QBoxLayout* m_currentLayout; - bool m_vert; - int m_curId, m_defId, m_oldId; - QButtonGroup* m_buttonGroup; +private: + QList m_objects; + QList m_layouts; + QBoxLayout* m_coreLayout; + QBoxLayout* m_currentLayout; + bool m_vert; + int m_curId, m_defId, m_oldId; + QButtonGroup* m_buttonGroup; - Q_DISABLE_COPY (RadioGroup) + Q_DISABLE_COPY (RadioGroup) - private slots: - void slot_buttonPressed (int btn); - void slot_buttonReleased (int btn); +private slots: + void slot_buttonPressed (int btn); + void slot_buttonReleased (int btn); };