Subversion Repositories Scribus

Rev

Rev 11229 | 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
*/
1579 tsoots 7
 /***************************************************************************
8
  *   Copyright (C) 2004 by Riku Leino                                      *
9
  *   tsoots@gmail.com                                                      *
10
  *                                                                         *
11
  *   This program is free software; you can redistribute it and/or modify  *
12
  *   it under the terms of the GNU General Public License as published by  *
13
  *   the Free Software Foundation; either version 2 of the License, or     *
14
  *   (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.  See the         *
19
  *   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                         *
23
  *   Free Software Foundation, Inc.,                                       *
18122 mrdocs 24
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
1579 tsoots 25
 ***************************************************************************/
26
 
27
#include "odtdia.h"
28
 
10010 fschmid 29
#include <QToolTip>
30
#include <QBoxLayout>
31
#include <QVBoxLayout>
8501 cbradney 32
#include <QPixmap>
10010 fschmid 33
#include <QHBoxLayout>
34
#include <QCheckBox>
35
#include <QPushButton>
2986 craig 36
#include "scribusapi.h"
10200 cbradney 37
#include "util_icon.h"
1579 tsoots 38
 
10010 fschmid 39
OdtDialog::OdtDialog(bool update, bool prefix, bool pack) : QDialog(0)
1579 tsoots 40
{
10010 fschmid 41
        setModal(true);
42
        setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
43
        setWindowTitle( tr("OpenDocument Importer Options"));
1579 tsoots 44
 
10010 fschmid 45
        QBoxLayout* layout = new QVBoxLayout(this);
46
        layout->setMargin(0);
47
        layout->setSpacing(0);
1579 tsoots 48
 
10010 fschmid 49
        QBoxLayout* hlayout = new QHBoxLayout;
50
        hlayout->setMargin(5);
51
        hlayout->setSpacing(5);
52
        updateCheck = new QCheckBox( tr("Overwrite Paragraph Styles"), this);
1579 tsoots 53
        updateCheck->setChecked(update);
10397 cbradney 54
        updateCheck->setToolTip( "<qt>" + tr("Enabling this will overwrite existing styles in the current Scribus document") + "</qt>");
1579 tsoots 55
        hlayout->addWidget(updateCheck);
56
        layout->addLayout(hlayout);
57
 
10010 fschmid 58
        QBoxLayout* palayout = new QHBoxLayout;
59
        palayout->setMargin(5);
60
        palayout->setSpacing(5);
61
        packCheck = new QCheckBox( tr("Merge Paragraph Styles"), this);
1579 tsoots 62
        packCheck->setChecked(pack);
10397 cbradney 63
        packCheck->setToolTip( "<qt>" + tr("Merge paragraph styles by attributes. This will result in fewer similar paragraph styles, will retain style attributes, even if the original document's styles are named differently.") +"</qt>");
1579 tsoots 64
        palayout->addWidget(packCheck);
65
        layout->addLayout(palayout);
66
 
10010 fschmid 67
        QBoxLayout* playout = new QHBoxLayout;
68
        playout->setMargin(5);
69
        playout->setSpacing(5);
70
        prefixCheck = new QCheckBox( tr("Use document name as a prefix for paragraph styles"), this);
1579 tsoots 71
        prefixCheck->setChecked(prefix);
10397 cbradney 72
        prefixCheck->setToolTip( "<qt>" + tr("Prepend the document name to the paragraph style name in Scribus.") +"</qt>");
1579 tsoots 73
        playout->addWidget(prefixCheck);
74
        layout->addLayout(playout);
75
 
10010 fschmid 76
        QBoxLayout* dlayout = new QHBoxLayout;
77
        dlayout->setMargin(5);
78
        dlayout->setSpacing(5);
79
        doNotAskCheck = new QCheckBox( tr("Do not ask again"), this);
1579 tsoots 80
        doNotAskCheck->setChecked(false);
10397 cbradney 81
        doNotAskCheck->setToolTip( "<qt>" + tr("Make these settings the default and do not prompt again when importing an OASIS OpenDocument.") +"</qt>");
2166 cbradney 82
        //dlayout->addStretch(10);
1579 tsoots 83
        dlayout->addWidget(doNotAskCheck);
84
        layout->addLayout(dlayout);
85
 
10010 fschmid 86
        QBoxLayout* blayout = new QHBoxLayout;
87
        blayout->setMargin(5);
88
        blayout->setSpacing(5);
1579 tsoots 89
        blayout->addStretch(10);
10010 fschmid 90
        okButton = new QPushButton( tr("OK"), this);
1579 tsoots 91
        blayout->addWidget(okButton);
10010 fschmid 92
        cancelButton = new QPushButton( tr("Cancel"), this);
3970 tsoots 93
        blayout->addWidget(cancelButton);
1579 tsoots 94
        layout->addLayout(blayout);
95
 
96
        connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
3970 tsoots 97
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
1579 tsoots 98
}
99
 
100
bool OdtDialog::shouldUpdate()
101
{
102
        return updateCheck->isChecked();
103
}
104
 
105
bool OdtDialog::usePrefix()
106
{
107
        return prefixCheck->isChecked();
108
}
109
 
110
bool OdtDialog::askAgain()
111
{
112
        return !(doNotAskCheck->isChecked());
113
}
114
 
115
bool OdtDialog::packStyles()
116
{
117
        return packCheck->isChecked();
118
}
119
 
120
OdtDialog::~OdtDialog()
121
{
122
 
11229 fschmid 123
}