]> Shamusworld >> Repos - architektonas/blob - src/forms/dlginitial.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / forms / dlginitial.cpp
1 // dlginitial.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  05/12/2010  Created this file. :-)
15 //
16
17 #include "dlginitial.h"
18
19 #include "enums.h"
20 #include "settings.h"
21 #include "system.h"
22 #include "units.h"
23
24 DlgInitial::DlgInitial(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
25         QDialog(parent, flags)
26 {
27         ui.setupUi(this);
28
29         // Fill combobox with languages:
30         QStringList languageList = SYSTEM->getLanguageList();
31
32         for(QStringList::Iterator it=languageList.begin(); it!=languageList.end(); it++)
33         {
34                 QString l = SYSTEM->symbolToLanguage(*it);
35 //              ui.cbLanguage->insertItem(l);
36 //              ui.cbLanguageCmd->insertItem(l);
37                 ui.cbLanguage->addItem(l);
38                 ui.cbLanguageCmd->addItem(l);
39         }
40
41         // units:
42         for(int i=RS2::None; i<RS2::LastUnit; i++)
43 //              ui.cbUnit->insertItem(Units::unitToString((RS2::Unit)i));
44                 ui.cbUnit->addItem(Units::unitToString((RS2::Unit)i));
45
46 //      ui.cbUnit->setCurrentText("Millimeter");
47 //      ui.cbLanguage->setCurrentText("English");
48 //      ui.cbLanguageCmd->setCurrentText("English");
49         ui.cbUnit->setItemText(ui.cbUnit->currentIndex(), "Millimeter");
50         ui.cbLanguage->setItemText(ui.cbLanguage->currentIndex(), "English");
51         ui.cbLanguageCmd->setItemText(ui.cbLanguageCmd->currentIndex(), "English");
52 }
53
54 DlgInitial::~DlgInitial()
55 {
56 }
57
58 void DlgInitial::setText(const QString & t)
59 {
60         ui.lWelcome->setText(t);
61 }
62
63 void DlgInitial::setPixmap(const QPixmap & p)
64 {
65         ui.lImage->setPixmap(p);
66 }
67
68 void DlgInitial::ok()
69 {
70         settings.beginGroup("Appearance");
71         settings.setValue("Language", SYSTEM->languageToSymbol(ui.cbLanguage->currentText()));
72         settings.setValue("LanguageCmd", SYSTEM->languageToSymbol(ui.cbLanguageCmd->currentText()));
73         settings.endGroup();
74
75         settings.beginGroup("Defaults");
76         settings.setValue("Unit", ui.cbUnit->currentText());
77         settings.endGroup();
78         accept();
79 }