1 /*
2  * This file is part of Licq, an instant messaging client for UNIX.
3  * Copyright (C) 2000-2010 Licq developers
4  *
5  * Licq 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) any later version.
9  *
10  * Licq 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 Licq; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef USEREVENTTABDLG_H
21 #define USEREVENTTABDLG_H
22 
23 #include "config.h"
24 
25 #include <QWidget>
26 
27 namespace Licq
28 {
29 class User;
30 }
31 
32 
33 namespace LicqQtGui
34 {
35 class TabWidget;
36 class UserEventCommon;
37 
38 class UserEventTabDlg : public QWidget
39 {
40   Q_OBJECT
41 
42 public:
43   UserEventTabDlg(QWidget* parent = 0, const char* name = 0);
44   ~UserEventTabDlg();
45 
46   void addTab(UserEventCommon* tab, int index = -1);
47   void selectTab(QWidget* tab);
48   void replaceTab(QWidget* oldTab, UserEventCommon* newTab);
49   bool tabIsSelected(QWidget* tab);
50   bool tabExists(QWidget* tab);
51   void updateConvoLabel(UserEventCommon* tab);
52   void updateTabLabel(const Licq::User* u);
53   void setTyping(const Licq::User* u, int convoId);
54 
55 #ifdef USE_KDE
56   virtual void setIcon(const QPixmap& icon);
57 #endif
58 
59 signals:
60   void signal_done();
61 
62 public slots:
63   /**
64    * Switch to tab index in action data
65    *
66    * @param action Action to get tab index from
67    */
68   void switchTab(QAction* action);
69 
70   void currentChanged(int index);
71   void moveLeft();
72   void moveRight();
73   void removeTab(QWidget* tab);
74   void setMsgWinSticky(bool sticky = true);
75 
76 private slots:
77   /**
78    * Update keyboard shortcuts from configuration
79    */
80   void updateShortcuts();
81 
82 private:
83   void updateTabLabel(UserEventCommon* tab, const Licq::User* u);
84 
85   TabWidget* myTabs;
86   QAction* myTabSwitch01Action;
87   QAction* myTabSwitch02Action;
88   QAction* myTabSwitch03Action;
89   QAction* myTabSwitch04Action;
90   QAction* myTabSwitch05Action;
91   QAction* myTabSwitch06Action;
92   QAction* myTabSwitch07Action;
93   QAction* myTabSwitch08Action;
94   QAction* myTabSwitch09Action;
95   QAction* myTabSwitch10Action;
96 
97   void updateTitle(QWidget* tab);
98   void clearEvents(QWidget* tab);
99   void saveGeometry();
100 
101   virtual void moveEvent(QMoveEvent* e);
102   virtual void resizeEvent(QResizeEvent* e);
103 };
104 
105 } // namespace LicqQtGui
106 
107 #endif
108