| 1 | /****************************************************************************
|
|---|
| 2 | ** $Id: qdir.h 160 2006-12-11 20:15:57Z dmik $
|
|---|
| 3 | **
|
|---|
| 4 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of an example program for Qt. This example
|
|---|
| 7 | ** program may be used, distributed and modified without limitation.
|
|---|
| 8 | **
|
|---|
| 9 | *****************************************************************************/
|
|---|
| 10 |
|
|---|
| 11 | #ifndef QDIREXAMPLE_H
|
|---|
| 12 | #define QDIREXAMPLE_H
|
|---|
| 13 |
|
|---|
| 14 | #include <qscrollview.h>
|
|---|
| 15 | #include <qfiledialog.h>
|
|---|
| 16 | #include <qwidgetstack.h>
|
|---|
| 17 | #include <qvbox.h>
|
|---|
| 18 | #include <qurl.h>
|
|---|
| 19 | #include <qpixmap.h>
|
|---|
| 20 | #include <qstringlist.h>
|
|---|
| 21 |
|
|---|
| 22 | class QMultiLineEdit;
|
|---|
| 23 | class QTextView;
|
|---|
| 24 | class DirectoryView;
|
|---|
| 25 | class QSpinBox;
|
|---|
| 26 | class QShowEvent;
|
|---|
| 27 | class QPopupMenu;
|
|---|
| 28 |
|
|---|
| 29 | class PixmapView : public QScrollView
|
|---|
| 30 | {
|
|---|
| 31 | Q_OBJECT
|
|---|
| 32 |
|
|---|
| 33 | public:
|
|---|
| 34 | PixmapView( QWidget *parent );
|
|---|
| 35 | void setPixmap( const QPixmap &pix );
|
|---|
| 36 | void drawContents( QPainter *p, int, int, int, int );
|
|---|
| 37 |
|
|---|
| 38 | private:
|
|---|
| 39 | QPixmap pixmap;
|
|---|
| 40 |
|
|---|
| 41 | };
|
|---|
| 42 |
|
|---|
| 43 | class Preview : public QWidgetStack
|
|---|
| 44 | {
|
|---|
| 45 | Q_OBJECT
|
|---|
| 46 |
|
|---|
| 47 | public:
|
|---|
| 48 | Preview( QWidget *parent );
|
|---|
| 49 | void showPreview( const QUrl &u, int size );
|
|---|
| 50 |
|
|---|
| 51 | private:
|
|---|
| 52 | QMultiLineEdit *normalText;
|
|---|
| 53 | QTextView *html;
|
|---|
| 54 | PixmapView *pixmap;
|
|---|
| 55 |
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 | class PreviewWidget : public QVBox,
|
|---|
| 59 | public QFilePreview
|
|---|
| 60 | {
|
|---|
| 61 | Q_OBJECT
|
|---|
| 62 |
|
|---|
| 63 | public:
|
|---|
| 64 | PreviewWidget( QWidget *parent );
|
|---|
| 65 | void previewUrl( const QUrl &u );
|
|---|
| 66 |
|
|---|
| 67 | private:
|
|---|
| 68 | QSpinBox *sizeSpinBox;
|
|---|
| 69 | Preview *preview;
|
|---|
| 70 |
|
|---|
| 71 | };
|
|---|
| 72 |
|
|---|
| 73 | class CustomFileDialog : public QFileDialog
|
|---|
| 74 | {
|
|---|
| 75 | Q_OBJECT
|
|---|
| 76 |
|
|---|
| 77 | public:
|
|---|
| 78 | CustomFileDialog();
|
|---|
| 79 | ~CustomFileDialog();
|
|---|
| 80 |
|
|---|
| 81 | protected:
|
|---|
| 82 | void showEvent( QShowEvent *e );
|
|---|
| 83 |
|
|---|
| 84 | public slots:
|
|---|
| 85 | void setDir2( const QString & );
|
|---|
| 86 |
|
|---|
| 87 | private slots:
|
|---|
| 88 | void bookmarkChosen( int i );
|
|---|
| 89 | void goHome();
|
|---|
| 90 |
|
|---|
| 91 | private:
|
|---|
| 92 | DirectoryView *dirView;
|
|---|
| 93 | QPopupMenu *bookmarkMenu;
|
|---|
| 94 | QStringList bookmarkList;
|
|---|
| 95 | int addId;
|
|---|
| 96 |
|
|---|
| 97 | };
|
|---|
| 98 |
|
|---|
| 99 | #endif
|
|---|