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  /***************************************************************************
8   *   Copyright (C) 2009 by Jain Basil Aliyas                               *
9   *   jainbasil@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.,                                       *
24   *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
25   ***************************************************************************/
26 
27 #include "xtgdialog.h"
28 
29 #include <QBoxLayout>
30 #include <QCheckBox>
31 #include <QHBoxLayout>
32 #include <QPixmap>
33 #include <QPushButton>
34 #include <QToolTip>
35 #include <QVBoxLayout>
36 
37 #include "scribusapi.h"
38 #include "iconmanager.h"
39 
XtgDialog(bool prefix)40 XtgDialog::XtgDialog(bool prefix) : QDialog(0)
41 {
42 	setModal(true);
43 	setWindowIcon(QIcon(IconManager::instance().loadIcon("AppIcon.png")));
44 	setWindowTitle( tr("Quark XPress Tags Importer Options"));
45 
46 	QBoxLayout* layout = new QVBoxLayout(this);
47 	layout->setContentsMargins(9, 9, 9, 9);
48 	layout->setSpacing(6);
49 
50 	QBoxLayout* playout = new QHBoxLayout;
51 	playout->setContentsMargins(0, 0, 0, 0);
52 	playout->setSpacing(6);
53 	prefixCheck = new QCheckBox( tr("Use document name as a prefix for Styles"), this);
54 	prefixCheck->setChecked(prefix);
55 	prefixCheck->setToolTip( "<qt>" + tr("Prepend the document name to the Style name in Scribus") +"</qt>");
56 	playout->addWidget(prefixCheck);
57 	layout->addLayout(playout);
58 
59 	QBoxLayout* dlayout = new QHBoxLayout;
60 	dlayout->setContentsMargins(0, 0, 0, 0);
61 	dlayout->setSpacing(6);
62 	doNotAskCheck = new QCheckBox( tr("Do not ask again"), this);
63 	doNotAskCheck->setChecked(false);
64 	doNotAskCheck->setToolTip( "<qt>" + tr("Make these settings the default and do not prompt again when importing an XPress Tags document") +"</qt>");
65 	//dlayout->addStretch(10);
66 	dlayout->addWidget(doNotAskCheck);
67 	layout->addLayout(dlayout);
68 
69 	QBoxLayout* blayout = new QHBoxLayout;
70 	blayout->setContentsMargins(0, 0, 0, 0);
71 	blayout->setSpacing(6);
72 	blayout->addStretch(10);
73 	okButton = new QPushButton( tr("OK"), this);
74 	blayout->addWidget(okButton);
75 	cancelButton = new QPushButton( tr("Cancel"), this);
76 	blayout->addWidget(cancelButton);
77 	layout->addLayout(blayout);
78 
79 	connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
80 	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
81 }
82 
usePrefix()83 bool XtgDialog::usePrefix()
84 {
85 	return prefixCheck->isChecked();
86 }
87 
askAgain()88 bool XtgDialog::askAgain()
89 {
90 	return !(doNotAskCheck->isChecked());
91 }
92 
~XtgDialog()93 XtgDialog::~XtgDialog()
94 {
95 
96 }
97 
98