KVIrc  4.9.2
DeveloperAPIs
KviImageDialog.h
Go to the documentation of this file.
1 #ifndef _KVI_IMAGEDIALOG_H_
2 #define _KVI_IMAGEDIALOG_H_
3 //=============================================================================
4 //
5 // File : KviImageDialog.h
6 // Creation date : Sun Dec 22 2002 19:42 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2002-2010 Szymon Stefanek (pragma at kvirc dot net)
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "kvi_settings.h"
28 #include "KviDynamicToolTip.h"
29 #include "KviTalListWidget.h"
30 #include "KviIconManager.h"
31 
32 #include <QDialog>
33 #include <QComboBox>
34 #include <QTimer>
35 #include <QStringList>
36 #include <QList>
37 
39 {
40 public:
42  QString m_szImageId;
43  QString m_szTipText;
44 
45 public:
46  KviImageDialogItem(KviTalListWidget * b, const QPixmap & thumb, const QString & szFile, const QString & image_id, const QString & szTipText = QString(), bool bIsFolder = false)
47  : KviTalListWidgetPixmap(b, thumb, szFile), m_bIsFolder(bIsFolder), m_szImageId(image_id), m_szTipText(szTipText){};
49 
50 public:
51  bool isFolder() { return m_bIsFolder; };
52  const QString & imageId() { return m_szImageId; };
53  const QString & tipText() { return m_szTipText; };
54  virtual int height(const KviTalListWidget *) const;
55  virtual int width(const KviTalListWidget *) const;
56  virtual void paint(QPainter * p);
57 };
58 
59 #define KID_TYPE_BUILTIN_IMAGES_SMALL 1
60 #define KID_TYPE_FULL_PATH 2
61 
62 #define KID_TYPE_ALL 3
63 
64 class KVIRC_API KviImageDialog : public QDialog
65 {
66  Q_OBJECT
67 public:
68  KviImageDialog(QWidget * par,
69  const QString & szCaption = QString(),
70  int types = KID_TYPE_ALL,
71  int initialType = 0,
72  const QString & szInitialDir = QString(),
73  int maxPreviewFileSize = 256000, bool modal = false);
74  virtual ~KviImageDialog();
75 
76 protected:
77  QComboBox * m_pTypeComboBox;
78  QList<int> * m_pTypeList;
80  QTimer * m_pTimer;
82 
84 
85  QString m_szJobPath;
86  QStringList m_lJobFileList;
87 
89 
91 
92  QString m_szInitialPath;
93 
95 
96 public:
97  const QString & selectedImage() { return m_szSelectedImage; };
98 protected:
99  void startJob(int type, const QString & szInitialPath = QString());
100  void jobTerminated();
101  virtual void closeEvent(QCloseEvent * e);
102 protected slots:
103  void okClicked();
104  void cancelClicked();
105  void heartbeat();
106  void jobTypeSelected(int index);
107  void itemDoubleClicked(QListWidgetItem * it);
108  void tipRequest(KviDynamicToolTip *, const QPoint & pnt);
109 };
110 
111 #endif //_KVI_IMAGEDIALOG_H_
QString m_szInitialPath
Definition: KviImageDialog.h:92
KviDynamicToolTip * m_pTip
Definition: KviImageDialog.h:94
virtual int width(const KviTalListWidget *) const
Definition: KviImageDialog.cpp:44
Definition: KviTalListWidget.h:35
Definition: KviDynamicToolTip.h:49
const QString & selectedImage()
Definition: KviImageDialog.h:97
#define KVIRC_API
Definition: kvi_settings.h:128
QString m_szImageId
Definition: KviImageDialog.h:42
Definition: KviTalListWidget.h:87
QString m_szTipText
Definition: KviImageDialog.h:43
Definition: KviImageDialog.h:64
bool m_bIsFolder
Definition: KviImageDialog.h:41
QTimer * m_pTimer
Definition: KviImageDialog.h:80
QString type()
Definition: KviRuntimeInfo.cpp:646
QString m_szJobPath
Definition: KviImageDialog.h:85
#define e
Definition: detector.cpp:69
QComboBox * m_pTypeComboBox
Definition: KviImageDialog.h:77
Definition: KviImageDialog.h:38
Icon manager.
int m_iMaxPreviewFileSize
Definition: KviImageDialog.h:83
QString m_szSelectedImage
Definition: KviImageDialog.h:90
int m_iJobIndexHelper
Definition: KviImageDialog.h:88
int m_iJobType
Definition: KviImageDialog.h:81
virtual int height(const KviTalListWidget *) const
Definition: KviImageDialog.cpp:39
KviTalListWidget * m_pListBox
Definition: KviImageDialog.h:79
#define KID_TYPE_ALL
Definition: KviImageDialog.h:62
const QString & imageId()
Definition: KviImageDialog.h:52
~KviImageDialogItem()
Definition: KviImageDialog.h:48
KviImageDialogItem(KviTalListWidget *b, const QPixmap &thumb, const QString &szFile, const QString &image_id, const QString &szTipText=QString(), bool bIsFolder=false)
Definition: KviImageDialog.h:46
This file contains compile time settings.
const QString & tipText()
Definition: KviImageDialog.h:53
QStringList m_lJobFileList
Definition: KviImageDialog.h:86
#define p
Definition: detector.cpp:80
QList< int > * m_pTypeList
Definition: KviImageDialog.h:78
bool isFolder()
Definition: KviImageDialog.h:51
virtual void paint(QPainter *p)
Definition: KviImageDialog.cpp:57