Subversion Repositories Scribus

Rev

Rev 5843 | 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
66
public:
67
        FDialogPreview(QWidget *pa);
68
        ~FDialogPreview() {};
311 Franz 69
        void updtPix();
3 paul 70
        void GenPreview(QString name);
71
        virtual void previewUrl(const QUrl &url);
72
};
73
 
5846 jghali 74
typedef enum {
75
        fdNone = 0,
76
        fdShowPreview = 1, // display text/image previewer
77
        fdExistingFiles = 2, // When set, set to the QFileDialog::ExistingFile mode when true, QFileDialog::AnyFile otherwise
78
        fdCompressFile = 4, // Show and handle the "Compress" behaviour and CheckBox (true)
79
        fdShowCodecs = 8, // Show and handle text codecs and ComboBox (true)
80
        fdDirectoriesOnly = 16 // Show only directories
81
} fdFlags;
82
 
4182 subik 83
/*! \brief A Scribus own file dialog.
84
Used almost everywhere. You can see extension handling
85
in e.g. bool SVGExportPlugin::run(QString filename).
86
*/
2969 craig 87
class SCRIBUS_API CustomFDialog : public QFileDialog
3 paul 88
{
89
    Q_OBJECT
4182 subik 90
public:
91
        /*! \brief Create Scribus file dialog.
92
        \param parent a reference to the QWidget parent.
93
        \param wDir starting working directory
94
        \param caption text caption of the dialog window
4645 subik 95
        \param filter a mask/filter. E.g.: *.txt
5846 jghali 96
        \param flags combination of fdFlags, default to fdExistingFiles
4182 subik 97
        */
5846 jghali 98
        /*CustomFDialog(QWidget *parent, QString wDir, QString caption = "",
4182 subik 99
                                  QString filter = "", bool preview = false,
100
                                  bool existing = true, bool compress = false,
5846 jghali 101
                                  bool codec = false, bool dirOnly = false);*/
102
        CustomFDialog(QWidget *parent, QString wDir, QString caption = "",  QString filter = "",
103
                                int flags = fdExistingFiles);
3 paul 104
        ~CustomFDialog();
4182 subik 105
 
106
        /*! \brief Set the default extension of the resulting file name.
107
        \param e string extension without any "."
108
        */
109
        void setExtension(QString e);
110
        /*! \brief Get the file extension
111
        \retval QString see setExtension(QString e) */
112
        QString extension();
113
        /*! \brief Set the "compress" extension of the resulting file name.
114
        \param e string extension without any "."
115
        */
116
        void setZipExtension(QString e);
117
        /*! \brief Get the zipped file extension
118
        \retval QString see setZipExtension(QString e) */
119
        QString zipExtension();
120
 
3 paul 121
        QDir cDir;
122
        QCheckBox* SaveZip;
5843 jghali 123
        QCheckBox* WithFonts;
124
        QCheckBox* WithProfiles;
3 paul 125
        QFrame* Layout;
126
        QToolButton* HomeB;
15 Franz 127
        QFrame* LayoutC;
128
        QComboBox *TxCodeM;
129
        QLabel *TxCodeT;
3 paul 130
private slots:
4182 subik 131
        //! \brief Go to the document home dir.
3 paul 132
        void slotHome();
4182 subik 133
        //! \brief Switch the filename extensions by compress checkbox state.
134
        void handleCompress();
3 paul 135
protected:
136
        QHBoxLayout* Layout1;
15 Franz 137
        QHBoxLayout* Layout1C;
4182 subik 138
        //! \brief Property with default extension
139
        QString ext;
140
        //! \brief Property with default compress extension
141
        QString extZip;
5846 jghali 142
        //! \brief Option flags given by user in ctore
143
        int optionFlags;
3 paul 144
};
145
 
146
#endif