ircdock.h
1 //------------------------------------------------------------------------------
2 // ircdock.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) 2010 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef __IRCDOCK_H_
24 #define __IRCDOCK_H_
25 
26 #include "dptr.h"
27 
28 #include <QDockWidget>
29 
30 class IRCAdapterBase;
31 class IRCDockTabContents;
32 class IRCNetworkAdapter;
34 class IRCSounds;
35 
39 class IRCDock : public QDockWidget
40 {
41  Q_OBJECT
42 
43 public:
44  IRCDock(QWidget *parent = nullptr);
45  ~IRCDock() override;
46 
47  IRCDockTabContents *addIRCAdapter(IRCAdapterBase *pIRCAdapter);
48 
53  bool hasTabFocus(const IRCDockTabContents *pTab) const;
54 
55  void performNetworkAutojoins();
56 
57  IRCSounds &sounds();
58  IRCDockTabContents *tabWithFocus();
59 
60 private:
61  DPtr<IRCDock> d;
62 
63  IRCNetworkAdapter *networkWithUiFocus();
64 
76  void connectToNewNetwork(const IRCNetworkConnectionInfo &connectionInfo, bool bFocusOnNewTab);
77 
82  QString prefixMessage(IRCAdapterBase *pTargetChatWindow, IRCAdapterBase *pMessageSender, const QString &message);
83  void setupToolbar();
84 
85 private slots:
86  void chatWindowCloseRequestSlot(IRCDockTabContents *pCaller);
87  void tabCloseRequestedSlot(int index);
88  void tabCurrentChanged(int index);
89  void tabFocusRequest(IRCDockTabContents *pCaller);
90  void titleChange(IRCDockTabContents *caller);
91  void titleChangeWithColorOfSenderIfNotFocused();
92  void toolBarAction(QAction *pAction);
93 };
94 
95 #endif