7 // Author: Jason Harris <kstars@30doradus.org>, (C) 2004
9 // Copyright: See COPYING file that comes with this distribution
14 #include "indifitsconf.h"
15 #include <kiconloader.h>
16 #include <kpushbutton.h>
17 #include <kfiledialog.h>
18 #include <klineedit.h>
20 #include <qcheckbox.h>
21 #include <qstringlist.h>
22 #include <qcombobox.h>
26 INDIFITSConf::INDIFITSConf(QWidget
* parent
, const char* name
, bool modal
, WFlags fl
)
27 : INDIConf(parent
,name
, modal
,fl
)
30 KIconLoader
*icons
= KGlobal::iconLoader();
31 selectDirB
->setPixmap( icons
->loadIcon( "fileopen", KIcon::Toolbar
) );
32 connect(selectDirB
, SIGNAL(clicked()), this, SLOT(saveFITSDirectory()));
33 connect(filterCombo
, SIGNAL(activated (int)), this, SLOT(comboUpdate(int)));
37 INDIFITSConf::~INDIFITSConf()
43 void INDIFITSConf::saveFITSDirectory()
45 QString dir
= KFileDialog::getExistingDirectory(fitsDIR_IN
->text());
48 fitsDIR_IN
->setText(dir
);
51 void INDIFITSConf::loadOptions()
53 QStringList filterNumbers
;
56 filterNumbers
<< "0" << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9";
57 filterCombo
->insertStringList(filterNumbers
);
59 timeCheck
->setChecked( Options::indiAutoTime() );
60 GeoCheck
->setChecked( Options::indiAutoGeo() );
61 crosshairCheck
->setChecked( Options::indiCrosshairs() );
62 messagesCheck
->setChecked ( Options::indiMessages() );
63 fitsAutoDisplayCheck
->setChecked( Options::indiFITSDisplay() );
64 telPort_IN
->setText ( Options::indiTelescopePort());
65 vidPort_IN
->setText ( Options::indiVideoPort());
67 if (Options::fitsSaveDirectory().isEmpty())
69 fitsDIR_IN
->setText (QDir:: homeDirPath());
70 Options::setFitsSaveDirectory( fitsDIR_IN
->text());
73 fitsDIR_IN
->setText ( Options::fitsSaveDirectory());
75 if (Options::filterAlias().empty())
76 filterList
<< "0" << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9";
78 filterList
= Options::filterAlias();
80 filterCombo
->setCurrentItem(lastIndex
);
81 filterAlias
->setText(filterList
[lastIndex
]);
85 void INDIFITSConf::saveOptions()
88 Options::setIndiAutoTime( timeCheck
->isChecked() );
89 Options::setIndiAutoGeo( GeoCheck
->isChecked() );
90 Options::setIndiCrosshairs( crosshairCheck
->isChecked() );
91 Options::setIndiMessages( messagesCheck
->isChecked() );
92 Options::setIndiFITSDisplay (fitsAutoDisplayCheck
->isChecked());
93 Options::setIndiTelescopePort ( telPort_IN
->text());
94 Options::setIndiVideoPort( vidPort_IN
->text());
95 Options::setFitsSaveDirectory( fitsDIR_IN
->text());
97 filterList
[lastIndex
] = filterAlias
->text();
98 Options::setFilterAlias(filterList
);
102 void INDIFITSConf::comboUpdate(int newIndex
)
104 filterList
[lastIndex
] = filterAlias
->text();
105 lastIndex
= newIndex
;
107 filterAlias
->setText(filterList
[lastIndex
]);
113 #include "indifitsconf.moc"