188 //! defined in the configuration entries. |
188 //! defined in the configuration entries. |
189 void updateActionShortcuts(); |
189 void updateActionShortcuts(); |
190 |
190 |
191 //! Gets the shortcut configuration for the given \c action |
191 //! Gets the shortcut configuration for the given \c action |
192 KeySequenceConfig* shortcutForAction (QAction* action); |
192 KeySequenceConfig* shortcutForAction (QAction* action); |
|
193 |
|
194 void endAction(); |
193 |
195 |
194 public slots: |
196 public slots: |
195 void changeCurrentFile(); |
197 void changeCurrentFile(); |
196 void slot_action(); |
198 void slot_action(); |
197 void slot_actionNew(); |
199 void slot_actionNew(); |
301 MessageManager* m_msglog; |
303 MessageManager* m_msglog; |
302 Ui_LDForgeUI* ui; |
304 Ui_LDForgeUI* ui; |
303 QTabBar* m_tabs; |
305 QTabBar* m_tabs; |
304 bool m_updatingTabs; |
306 bool m_updatingTabs; |
305 |
307 |
306 void endAction(); |
|
307 |
|
308 private slots: |
308 private slots: |
309 void slot_selectionChanged(); |
309 void slot_selectionChanged(); |
310 void slot_recentFile(); |
310 void slot_recentFile(); |
311 void slot_quickColor(); |
311 void slot_quickColor(); |
312 void slot_lastSecondCleanup(); |
312 void slot_lastSecondCleanup(); |
323 QList<LDQuickColor> quickColorsFromConfig(); |
323 QList<LDQuickColor> quickColorsFromConfig(); |
324 |
324 |
325 //! Asks the user a yes/no question with the given \c message and the given |
325 //! Asks the user a yes/no question with the given \c message and the given |
326 //! window \c title. |
326 //! window \c title. |
327 //! \returns true if the user answered yes, false if no. |
327 //! \returns true if the user answered yes, false if no. |
328 bool confirm (QString title, QString message); // Generic confirm prompt |
328 bool confirm (const QString& title, const QString& message); // Generic confirm prompt |
329 |
329 |
330 //! An overload of \c confirm(), this asks the user a yes/no question with the |
330 //! An overload of \c confirm(), this asks the user a yes/no question with the |
331 //! given \c message. |
331 //! given \c message. |
332 //! \returns true if the user answered yes, false if no. |
332 //! \returns true if the user answered yes, false if no. |
333 bool confirm (QString message); |
333 bool confirm (const QString& message); |
334 |
334 |
335 //! Displays an error prompt with the given \c message |
335 //! Displays an error prompt with the given \c message |
336 void critical (QString message); |
336 void critical (const QString& message); |
337 |
337 |
338 //! Makes an icon of \c size x \c size pixels to represent \c colinfo |
338 //! Makes an icon of \c size x \c size pixels to represent \c colinfo |
339 QIcon makeColorIcon (LDColor* colinfo, const int size); |
339 QIcon makeColorIcon (LDColor* colinfo, const int size); |
340 |
340 |
341 //! Fills the given combo-box with color information |
341 //! Fills the given combo-box with color information |
349 //! selected one. |
349 //! selected one. |
350 //! \returns returns the value of the first found radio button that was checked |
350 //! \returns returns the value of the first found radio button that was checked |
351 //! \returns by the user. |
351 //! \returns by the user. |
352 //! |
352 //! |
353 template<class T> |
353 template<class T> |
354 T radioSwitch (const T& defval, QList<pair<QRadioButton*, T>> haystack) |
354 T radioSwitch (const T& defval, QList<Pair<QRadioButton*, T>> haystack) |
355 { |
355 { |
356 for (pair<QRadioButton*, const T&> i : haystack) |
356 for (Pair<QRadioButton*, const T&> i : haystack) |
357 if (i.first->isChecked()) |
357 if (i.first->isChecked()) |
358 return i.second; |
358 return i.second; |
359 |
359 |
360 return defval; |
360 return defval; |
361 } |
361 } |
363 //! |
363 //! |
364 //! Takes in pairs of radio buttons and respective values and checks the first |
364 //! Takes in pairs of radio buttons and respective values and checks the first |
365 //! found radio button whose respsective value matches \c expr have the given value. |
365 //! found radio button whose respsective value matches \c expr have the given value. |
366 //! |
366 //! |
367 template<class T> |
367 template<class T> |
368 void radioDefault (const T& expr, QList<pair<QRadioButton*, T>> haystack) |
368 void radioDefault (const T& expr, QList<Pair<QRadioButton*, T>> haystack) |
369 { |
369 { |
370 for (pair<QRadioButton*, const T&> i : haystack) |
370 for (Pair<QRadioButton*, const T&> i : haystack) |
371 { |
371 { |
372 if (i.second == expr) |
372 if (i.second == expr) |
373 { |
373 { |
374 i.first->setChecked (true); |
374 i.first->setChecked (true); |
375 return; |
375 return; |