1 //=========================================== 2 // Lumina Desktop Source Code 3 // Copyright (c) 2016, Ken Moore 4 // Available under the 3-clause BSD license 5 // See the LICENSE file for full details 6 //=========================================== 7 #ifndef _LUMINA_CONFIG_PAGE_WIDGET_UI_H 8 #define _LUMINA_CONFIG_PAGE_WIDGET_UI_H 9 #include "../globals.h" 10 //=============================== 11 // NOTES FOR CREATING SUBPAGES 12 //=============================== 13 // 1) Subclass this PageWidget for any client page 14 // 2) Init any internal widgets/classes in the constructor 15 // 3) Make sure you handle the [Save/Load]Settings functions (LoadSettings() will be called automatially after widget creation) 16 // 4) Make sure to emit the signals as needed for interactivity with the main container 17 //=============================== 18 19 //Structure of all information needed for a page 20 struct PAGEINFO{ 21 QString name, title, icon, comment, category, id; 22 QStringList req_systems, search_tags; 23 }; 24 25 //Main widget class needed to show a configuration page 26 class PageWidget : public QWidget{ 27 Q_OBJECT 28 public: 29 30 //Main constructor/destructor (create/destroy any interface items) PageWidget(QWidget * parent)31 PageWidget(QWidget *parent) : QWidget(parent){ 32 //this->setFocusPolicy(Qt::NoFocus); 33 } ~PageWidget()34 ~PageWidget(){} 35 needsScreenSelector()36 virtual bool needsScreenSelector(){ return false; } //change this to true for pages which load/set options on a per-screen basis setPreviousPage(QString)37 virtual void setPreviousPage(QString){ } //re-implement this if the page needs knowledge of what the previous page was 38 39 signals: 40 //emit this when the page has changes which are waiting to be saved 41 void HasPendingChanges(bool); 42 //emit this when the page title changes (will updates main UI as needed) 43 void ChangePageTitle(QString); 44 //emit this when we need to change to another client/page (if needed - generally only used for the base/group pages) 45 void ChangePage(QString); //ID of new page to open 46 47 public slots: 48 //User requested to save any pending changes SaveSettings()49 virtual void SaveSettings(){} LoadSettings(int)50 virtual void LoadSettings(int){} //INPUT: Screen number (0+) updateIcons()51 virtual void updateIcons(){} 52 53 //Simplification function for widget connections settingChanged()54 virtual void settingChanged(){ 55 emit HasPendingChanges(true); 56 } 57 }; 58 59 #endif 60