1 /***************************************************************************
2 * Copyright (C) 2005-2018 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"
25 #include "ui_dccsettingspage.h"
28 * A settingspage for configuring DCC.
30 class DccSettingsPage : public SettingsPage
38 * @param[in] parent QObject parent
40 DccSettingsPage(QWidget *parent = nullptr);
42 /// See base class docs
43 bool hasDefaults() const override;
46 // See base class docs
49 void defaults() override;
53 * Whether the client's DccConfig is valid
55 * @returns true if the client is connected and its DccConfig instance synchronized
57 bool isClientConfigValid() const;
60 * Set the client config
62 * @param[in] config The client's config. Must be be valid or a nullptr.
64 void setClientConfig(DccConfig *config);
66 // See base class docs
67 QVariant loadAutoWidgetValue(const QString &widgetName) override;
68 void saveAutoWidgetValue(const QString &widgetName, const QVariant &value) override;
72 * Updates the enabled state according to the current config.
74 void updateWidgetStates();
77 * Checks if the current unsaved config differs from the client's and sets state accordingly.
79 void widgetHasChanged();
82 * Called if the client's config was changed (e.g. if the connection state changed).
84 void onClientConfigChanged();
87 Ui::DccSettingsPage ui; ///< The UI object
88 DccConfig *_clientConfig {nullptr}; ///< Pointer to the client's config (nullptr if not synchronized/available)
89 DccConfig _localConfig; ///< Local config reflecting the widget states