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 * mail@jainbasil.net *
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 "fontselectdialog.h"
28 #include "iconmanager.h"
29 #include <QDebug>
30
FontSelect(QStringList list)31 FontSelect::FontSelect(QStringList list):QDialog(0)
32 {
33 setModal(true);
34 setWindowIcon(QIcon(IconManager::instance().loadIcon("AppIcon.png")));
35 setWindowTitle( tr("Select Alternate Font"));
36
37 resize(370, 83);
38 layoutWidget = new QWidget(this);
39 layoutWidget->setGeometry(QRect(10, 10, 350, 63));
40 verticalLayout_2 = new QVBoxLayout(layoutWidget);
41 verticalLayout_2->setContentsMargins(0, 0, 0, 0);
42 horizontalLayout_2 = new QHBoxLayout();
43 label = new QLabel(layoutWidget);
44 label->setText( tr("Font") );
45 label->setMinimumSize(QSize(61, 0));
46
47 horizontalLayout_2->addWidget(label);
48
49 fontList = new QComboBox(layoutWidget);
50 fontList->setMinimumSize(QSize(281, 0));
51 fontList->addItems(list);
52
53 horizontalLayout_2->addWidget(fontList);
54
55 verticalLayout_2->addLayout(horizontalLayout_2);
56
57 horizontalLayout_3 = new QHBoxLayout();
58 horizontalSpacer = new QSpacerItem(128, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
59
60 horizontalLayout_3->addItem(horizontalSpacer);
61
62 okButton = new QPushButton("OK",layoutWidget);
63 okButton->setEnabled(true);
64 okButton->setMinimumSize(QSize(105, 0));
65
66 horizontalLayout_3->addWidget(okButton);
67
68 verticalLayout_2->addLayout(horizontalLayout_3);
69 label->setBuddy(fontList);
70 font = fontList->currentText();
71
72 connect(fontList, SIGNAL(activated(int)), this, SLOT(selectFont()));
73 connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
74 }
75
selectFont()76 void FontSelect::selectFont()
77 {
78 font = fontList->currentText();
79 }
80
setFont()81 QString FontSelect::setFont()
82 {
83 return font;
84 }
85
resetFont()86 void FontSelect::resetFont()
87 {
88 font = "";
89 }
90