summaryrefslogtreecommitdiffstats
path: root/examples/qdir/qdir.h
blob: a4bee8f78515bea2f6d1d650ba7b975bbbf1c38e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/****************************************************************************
**
** Copyright (C) 1992-2008 Trolltech ASA.  All rights reserved.
**
** This file is part of an example program for Qt.  This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/

#ifndef QDIREXAMPLE_H
#define QDIREXAMPLE_H

#include <qscrollview.h>
#include <qfiledialog.h>
#include <qwidgetstack.h>
#include <qvbox.h>
#include <qurl.h>
#include <qpixmap.h>
#include <qstringlist.h>

class QMultiLineEdit;
class QTextView;
class DirectoryView;
class QSpinBox;
class QShowEvent;
class QPopupMenu;

class PixmapView : public QScrollView
{
    Q_OBJECT

public:
    PixmapView( QWidget *parent );
    void setPixmap( const QPixmap &pix );
    void drawContents( QPainter *p, int, int, int, int );

private:
    QPixmap pixmap;

};

class Preview : public QWidgetStack
{
    Q_OBJECT

public:
    Preview( QWidget *parent );
    void showPreview( const QUrl &u, int size );

private:
    QMultiLineEdit *normalText;
    QTextView *html;
    PixmapView *pixmap;

};

class PreviewWidget : public QVBox,
		      public QFilePreview
{
    Q_OBJECT

public:
    PreviewWidget( QWidget *parent );
    void previewUrl( const QUrl &u );

private:
    QSpinBox *sizeSpinBox;
    Preview *preview;

};

class CustomFileDialog : public QFileDialog
{
    Q_OBJECT

public:
    CustomFileDialog();
    ~CustomFileDialog();

protected:
    void showEvent( QShowEvent *e );

public slots:
    void setDir2( const QString & );

private slots:
    void bookmarkChosen( int i );
    void goHome();

private:
    DirectoryView *dirView;
    QPopupMenu *bookmarkMenu;
    QStringList bookmarkList;
    int addId;

};

#endif