File indexing completed on 2024-05-19 04:50:29

0001 /****************************************************************************************
0002  * Copyright (c) 2012 Matěj Laitl <matej@laitl.cz>                                      *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef STATSYNCING_CHOOSEPROVIDERSPAGE_H
0018 #define STATSYNCING_CHOOSEPROVIDERSPAGE_H
0019 
0020 #include "ui_ChooseProvidersPage.h"
0021 
0022 namespace StatSyncing
0023 {
0024     class ProvidersModel;
0025 
0026     class ChooseProvidersPage : public QWidget, private Ui::ChooseProvidersPage
0027     {
0028         Q_OBJECT
0029 
0030         public:
0031             explicit ChooseProvidersPage( QWidget *parent = nullptr, Qt::WindowFlags f = {} );
0032             ~ChooseProvidersPage() override;
0033 
0034             void setFields( const QList<qint64> &fields, qint64 checkedFields );
0035             qint64 checkedFields() const;
0036 
0037             /**
0038              * Sets the model of providers to choose from. ChooseProvidersPage does _not_
0039              * take ownership of the model or the selection model.
0040              */
0041             void setProvidersModel( ProvidersModel *model, QItemSelectionModel *selectionModel );
0042 
0043         public Q_SLOTS:
0044             void disableControls();
0045             void setProgressBarText( const QString &text );
0046             void setProgressBarMaximum( int maximum );
0047             void progressBarIncrementProgress();
0048 
0049         Q_SIGNALS:
0050             void checkedFieldsChanged();
0051 
0052             /**
0053              * Emitted when user clicks the Next button.
0054              */
0055             void accepted();
0056 
0057             /**
0058              * Emitted when user pushes the Cancel button.
0059              */
0060             void rejected();
0061 
0062         private Q_SLOTS:
0063             void updateMatchedLabel();
0064             void updateEnabledFields();
0065             void openConfiguration();
0066 
0067         private:
0068             ProvidersModel *m_providersModel;
0069     };
0070 } // namespace StatSyncing
0071 
0072 #endif // STATSYNCING_CHOOSEPROVIDERSPAGE_H