Subversion Repositories Scribus

Rev

Rev 5917 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
3 paul 7
/***************************************************************************
8
                          customfdialog.h  -  description
9
                             -------------------
10
    begin                : Fri Nov 30 2001
11
    copyright            : (C) 2001 by Franz Schmid
12
    email                : Franz.Schmid@altmuehlnet.de
13
 ***************************************************************************/
14
 
15
/***************************************************************************
16
 *                                                                         *
17
 *   This program is free software; you can redistribute it and/or modify  *
18
 *   it under the terms of the GNU General Public License as published by  *
19
 *   the Free Software Foundation; either version 2 of the License, or     *
20
 *   (at your option) any later version.                                   *
21
 *                                                                         *
22
 ***************************************************************************/
23
 
24
#ifndef CUSTOMFDIALOG_H
25
#define CUSTOMFDIALOG_H
26
 
27
#include <qfiledialog.h>
28
#include <qurl.h>
29
#include <qlabel.h>
30
#include <qdir.h>
31
#include <qpixmap.h>
32
#include <qcheckbox.h>
33
#include <qlayout.h>
34
#include <qframe.h>
35
#include <qtoolbutton.h>
15 Franz 36
#include <qcombobox.h>
415 Franz 37
#include <qstring.h>
2969 craig 38
 
39
#include "scribusapi.h"
40
 
3 paul 41
/**
42
  *@author Franz Schmid
43
  */
2969 craig 44
class SCRIBUS_API ImIconProvider : public QFileIconProvider
3 paul 45
{
46
    Q_OBJECT
47
    QStringList fmts;
48
    QPixmap imagepm;
49
    QPixmap docpm;
50
    QPixmap pspm;
51
    QPixmap pdfpm;
52
    QPixmap txtpm;
867 fschmid 53
    QPixmap oosxdpm;
54
    QPixmap oosxwpm;
55
    QPixmap vectorpm;
3 paul 56
public:
57
    ImIconProvider(QWidget *pa);
58
    ~ImIconProvider() {};
59
 
60
    const QPixmap * pixmap(const QFileInfo &fi);
61
};
62
 
2969 craig 63
class SCRIBUS_API FDialogPreview : public QLabel, public QFilePreview
3 paul 64
{
65
    Q_OBJECT
6269 jghali 66
protected:
67
        QString filePath;
3 paul 68
public:
69
        FDialogPreview(QWidget *pa);
70
        ~FDialogPreview() {};
311 Franz 71
        void updtPix();
3 paul 72
        void GenPreview(QString name);
73
        virtual void previewUrl(const QUrl &url);
74
};
75
 
5846 jghali 76
typedef enum {
77
        fdNone = 0,
78
        fdShowPreview = 1, // display text/image previewer
79
        fdExistingFiles = 2, // When set, set to the QFileDialog::ExistingFile mode when true, QFileDialog::AnyFile otherwise
80
        fdCompressFile = 4, // Show and handle the "Compress" behaviour and CheckBox (true)
81
        fdShowCodecs = 8, // Show and handle text codecs and ComboBox (true)
82
        fdDirectoriesOnly = 16 // Show only directories
83
} fdFlags;
84
 
4182 subik 85
/*! \brief A Scribus own file dialog.
86
Used almost everywhere. You can see extension handling
87
in e.g. bool SVGExportPlugin::run(QString filename).
88
*/
2969 craig 89
class SCRIBUS_API CustomFDialog : public QFileDialog
3 paul 90
{
91
    Q_OBJECT
4182 subik 92
public:
93
        /*! \brief Create Scribus file dialog.
94
        \param parent a reference to the QWidget parent.
95
        \param wDir starting working directory
96
        \param caption text caption of the dialog window
4645 subik 97
        \param filter a mask/filter. E.g.: *.txt
5846 jghali 98
        \param flags combination of fdFlags, default to fdExistingFiles
4182 subik 99
        */
5846 jghali 100
        CustomFDialog(QWidget *parent, QString wDir, QString caption = "",  QString filter = "",
101
                                int flags = fdExistingFiles);
3 paul 102
        ~CustomFDialog();
4182 subik 103
 
104
        /*! \brief Set the default extension of the resulting file name.
105
        \param e string extension without any "."
106
        */
107
        void setExtension(QString e);
108
        /*! \brief Get the file extension
109
        \retval QString see setExtension(QString e) */
110
        QString extension();
111
        /*! \brief Set the "compress" extension of the resulting file name.
112
        \param e string extension without any "."
113
        */
114
        void setZipExtension(QString e);
115
        /*! \brief Get the zipped file extension
116
        \retval QString see setZipExtension(QString e) */
117
        QString zipExtension();
118
 
3 paul 119
        QDir cDir;
120
        QCheckBox* SaveZip;
5843 jghali 121
        QCheckBox* WithFonts;
122
        QCheckBox* WithProfiles;
3 paul 123
        QFrame* Layout;
124
        QToolButton* HomeB;
15 Franz 125
        QFrame* LayoutC;
126
        QComboBox *TxCodeM;
127
        QLabel *TxCodeT;
3 paul 128
private slots:
4182 subik 129
        //! \brief Go to the document home dir.
3 paul 130
        void slotHome();
4182 subik 131
        //! \brief Switch the filename extensions by compress checkbox state.
132
        void handleCompress();
3 paul 133
protected:
134
        QHBoxLayout* Layout1;
15 Franz 135
        QHBoxLayout* Layout1C;
4182 subik 136
        //! \brief Property with default extension
137
        QString ext;
138
        //! \brief Property with default compress extension
139
        QString extZip;
5846 jghali 140
        //! \brief Option flags given by user in ctore
141
        int optionFlags;
3 paul 142
};
143
 
144
#endif