1 /***************************************************************************
2 * Copyright (C) 2005-2020 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
23 #include "dccconfig.h"
24 #include "settingspage.h"
26 #include "ui_dccsettingspage.h"
29 * A settingspage for configuring DCC.
31 class DccSettingsPage : public SettingsPage
39 * @param[in] parent QObject parent
41 DccSettingsPage(QWidget* parent = nullptr);
43 /// See base class docs
44 bool hasDefaults() const override;
47 // See base class docs
48 void save() final override;
49 void load() final override;
50 void defaults() final override;
54 * Whether the client's DccConfig is valid
56 * @returns true if the client is connected and its DccConfig instance synchronized
58 bool isClientConfigValid() const;
61 * Set the client config
63 * @param[in] config The client's config. Must be be valid or a nullptr.
65 void setClientConfig(DccConfig* config);
67 // See base class docs
68 QVariant loadAutoWidgetValue(const QString& widgetName) override;
69 void saveAutoWidgetValue(const QString& widgetName, const QVariant& value) override;
73 * Updates the enabled state according to the current config.
75 void updateWidgetStates();
78 * Checks if the current unsaved config differs from the client's and sets state accordingly.
80 void widgetHasChanged();
83 * Called if the client's config was changed (e.g. if the connection state changed).
85 void onClientConfigChanged();
88 Ui::DccSettingsPage ui; ///< The UI object
89 DccConfig* _clientConfig{nullptr}; ///< Pointer to the client's config (nullptr if not synchronized/available)
90 DccConfig _localConfig; ///< Local config reflecting the widget states