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