X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fsettingspage.h;h=247efb1f6e353a48fcc2a96cac81192eca643f02;hp=91171df6b70665e208cc7f99d8b00fe0fcb69c39;hb=d28b9ec38b6ea0bc473200fc2f1e65abd1b56bd6;hpb=8b68bdc964968d1d988242c37a598ba88cd0551c diff --git a/src/uisupport/settingspage.h b/src/uisupport/settingspage.h index 91171df6..247efb1f 100644 --- a/src/uisupport/settingspage.h +++ b/src/uisupport/settingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-07 by the Quassel IRC Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -32,16 +32,23 @@ class SettingsPage : public QWidget { virtual ~SettingsPage() {}; virtual QString category() const; virtual QString title() const; + virtual bool hasDefaults() const; - virtual bool hasChanged() const = 0; + bool hasChanged() const; + + //! Called immediately before save() is called. + /** Derived classes should return false if saving is not possible (e.g. the current settings are invalid). + * \return false, if the SettingsPage cannot be saved in its current state. + */ + virtual bool aboutToSave(); public slots: virtual void save() = 0; virtual void load() = 0; - virtual void defaults() = 0; + virtual void defaults(); protected slots: - //! Calling this slot is equivalent to emitting changed(true). + //! Calling this slot is equivalent to calling changeState(true). void changed(); protected: @@ -49,10 +56,12 @@ class SettingsPage : public QWidget { void changeState(bool hasChanged = true); signals: + //! Emitted whenever the widget state changes. void changed(bool hasChanged); private: QString _category, _title; + bool _changed; }; #endif