Subversion Repositories Scribus

Rev

Rev 23054 | 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
*/
411 Franz 7
#include "sxwdia.h"
8
 
10010 fschmid 9
#include <QToolTip>
10
#include <QBoxLayout>
11
#include <QVBoxLayout>
12
#include <QPixmap>
13
#include <QHBoxLayout>
14
#include <QCheckBox>
15
#include <QPushButton>
16
 
2986 craig 17
#include "scribusapi.h"
20185 craig 18
#include "iconmanager.h"
411 Franz 19
 
22612 craig 20
SxwDialog::SxwDialog(bool update, bool prefix, bool pack) : QDialog(nullptr)
411 Franz 21
{
10010 fschmid 22
        setModal(true);
23054 craig 23
        setWindowIcon(QIcon(IconManager::instance().loadIcon("AppIcon.png")));
10010 fschmid 24
        setWindowTitle( tr("OpenOffice.org Writer Importer Options"));
411 Franz 25
 
10010 fschmid 26
        QBoxLayout* layout = new QVBoxLayout(this);
24515 jghali 27
        layout->setContentsMargins(9, 9, 9, 9);
28
        layout->setSpacing(6);
411 Franz 29
 
10010 fschmid 30
        QBoxLayout* hlayout = new QHBoxLayout;
24515 jghali 31
        hlayout->setContentsMargins(0, 0, 0, 0);
32
        hlayout->setSpacing(6);
10010 fschmid 33
        updateCheck = new QCheckBox( tr("Overwrite Paragraph Styles"), this);
411 Franz 34
        updateCheck->setChecked(update);
10397 cbradney 35
        updateCheck->setToolTip( "<qt>" + tr("Enabling this will overwrite existing styles in the current Scribus document") + "</qt>");
411 Franz 36
        hlayout->addWidget(updateCheck);
37
        layout->addLayout(hlayout);
1157 tsoots 38
 
10010 fschmid 39
        QBoxLayout* palayout = new QHBoxLayout;
24515 jghali 40
        palayout->setContentsMargins(0, 0, 0, 0);
41
        palayout->setSpacing(6);
10010 fschmid 42
        packCheck = new QCheckBox( tr("Merge Paragraph Styles"), this);
1157 tsoots 43
        packCheck->setChecked(pack);
10397 cbradney 44
        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>");
1157 tsoots 45
        palayout->addWidget(packCheck);
46
        layout->addLayout(palayout);
411 Franz 47
 
10010 fschmid 48
        QBoxLayout* playout = new QHBoxLayout;
24515 jghali 49
        playout->setContentsMargins(0, 0, 0, 0);
50
        playout->setSpacing(6);
10010 fschmid 51
        prefixCheck = new QCheckBox( tr("Use document name as a prefix for paragraph styles"), this);
415 Franz 52
        prefixCheck->setChecked(prefix);
10397 cbradney 53
        prefixCheck->setToolTip( "<qt>" + tr("Prepend the document name to the paragraph style name in Scribus.") +"</qt>");
415 Franz 54
        playout->addWidget(prefixCheck);
55
        layout->addLayout(playout);
411 Franz 56
 
10010 fschmid 57
        QBoxLayout* dlayout = new QHBoxLayout;
24515 jghali 58
        dlayout->setContentsMargins(0, 0, 0, 0);
59
        dlayout->setSpacing(6);
10010 fschmid 60
        doNotAskCheck = new QCheckBox( tr("Do not ask again"), this);
415 Franz 61
        doNotAskCheck->setChecked(false);
20272 craig 62
        doNotAskCheck->setToolTip( "<qt>" + tr("Make these settings the default and do not prompt again when importing an OpenOffice.org 1.x document") +"</qt>");
2166 cbradney 63
        //dlayout->addStretch(10);
415 Franz 64
        dlayout->addWidget(doNotAskCheck);
65
        layout->addLayout(dlayout);
66
 
10010 fschmid 67
        QBoxLayout* blayout = new QHBoxLayout;
24515 jghali 68
        blayout->setContentsMargins(0, 0, 0, 0);
69
        blayout->setSpacing(6);
411 Franz 70
        blayout->addStretch(10);
10010 fschmid 71
        okButton = new QPushButton( tr("OK"), this);
411 Franz 72
        blayout->addWidget(okButton);
10010 fschmid 73
        cancelButton = new QPushButton( tr("Cancel"), this);
3970 tsoots 74
        blayout->addWidget(cancelButton);
411 Franz 75
        layout->addLayout(blayout);
76
 
77
        connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
3970 tsoots 78
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
411 Franz 79
}
80
 
81
bool SxwDialog::shouldUpdate()
82
{
83
        return updateCheck->isChecked();
84
}
85
 
415 Franz 86
bool SxwDialog::usePrefix()
87
{
88
        return prefixCheck->isChecked();
89
}
90
 
411 Franz 91
bool SxwDialog::askAgain()
92
{
93
        return !(doNotAskCheck->isChecked());
94
}
95
 
1157 tsoots 96
bool SxwDialog::packStyles()
97
{
10010 fschmid 98
        return packCheck->isChecked();
1157 tsoots 99
}
100
 
411 Franz 101
SxwDialog::~SxwDialog()
102
{
103
 
104
}
105