ircnetworkselectionbox.h
1 //------------------------------------------------------------------------------
2 // ircnetworkselectionbox.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
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.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2010 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef __IRCNETWORKSELECTIONBOX_H__
24 #define __IRCNETWORKSELECTIONBOX_H__
25 
26 #include "dptr.h"
27 
28 #include <QDialog>
29 
31 class IRCNetworkEntity;
32 
33 class IRCNetworkSelectionBox : public QDialog
34 {
35  Q_OBJECT
36 
37  public:
38  IRCNetworkSelectionBox(QWidget* parent = NULL);
40 
41  void accept();
42 
50  IRCNetworkEntity network() const;
51 
52  IRCNetworkConnectionInfo networkConnectionInfo() const;
53 
54  private:
55  void fetchNetworks();
56  void initWidgets();
57 
58  void addNetworkToComboBox(const IRCNetworkEntity& network);
59  QString buildTitle(const IRCNetworkEntity &network) const;
63  IRCNetworkEntity networkCurrent() const;
64  IRCNetworkEntity networkAtRow(int row) const;
65  bool replaceNetworkInConfig(const IRCNetworkEntity &oldNetwork, const IRCNetworkEntity &newNetwork);
66  void setNetworkMatchingDescriptionAsCurrent(const QString &description);
67  void updateCurrentNetwork(const IRCNetworkEntity &network);
68  void updateNetworkInfo();
69  bool validate();
70 
72  private slots:
73  void createNewNetwork();
74  void editCurrentNetwork();
75  void networkChanged(int index);
76 };
77 
78 #endif
Struct containing information about client's connection to the IRC server.
IRCNetworkEntity network() const
Extracts network specified in this dialog.
Data structure that describes and defines a connection to an IRC network or server.