chatnetworkscfg.h
1 //------------------------------------------------------------------------------
2 // chatnetworkscfg.h
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; 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) 2014 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef id6b479233_6426_4c75_892a_674e329b97f8
24 #define id6b479233_6426_4c75_892a_674e329b97f8
25 
26 #include <QList>
27 #include <QString>
28 #include <QWidget>
29 
30 class Ini;
31 class IniSection;
32 class IRCNetworkEntity;
33 
35 {
36 public:
37  QList<IRCNetworkEntity> autoJoinNetworks() const;
38  bool isAnyNetworkOnAutoJoin() const;
39 
40  IRCNetworkEntity lastUsedNetwork() const;
41  void setLastUsedNetwork(const IRCNetworkEntity &network);
42 
43  QList<IRCNetworkEntity> networks() const;
44  void setNetworks(const QList<IRCNetworkEntity> &networks);
45 
46  IRCNetworkEntity network(const QString &description);
47 
51  void removeNetwork(const IRCNetworkEntity &network);
52 
58  bool replaceNetwork(const QString &oldDescription, const IRCNetworkEntity &newNetwork,
59  QWidget *errorDisplayParentWidget);
60 
61 private:
62  static const QString SECTIONS_NAMES_PREFIX;
63 
64  QVector<IniSection> allNetworksSections() const;
65  void clearNetworkSections();
66  Ini &ini() const;
67  IRCNetworkEntity loadNetwork(const IniSection &section) const;
68  IniSection networkSection(int id);
69  void saveNetwork(IniSection section, const IRCNetworkEntity &network);
70 };
71 
72 #endif