opsekos.cpp 3.19 KB
Newer Older
1
2
3
4
5
6
7
/*  INDI Options
    Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com)

    This application is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
8

9
10
 */

Jasem Mutlaq's avatar
Jasem Mutlaq committed
11
#include <QPushButton>
Jasem Mutlaq's avatar
Jasem Mutlaq committed
12
#include <QFileDialog>
13
14
15
16
#include <QCheckBox>
#include <QStringList>
#include <QComboBox>

Jasem Mutlaq's avatar
Jasem Mutlaq committed
17
#include <KConfigDialog>
18

Jasem Mutlaq's avatar
Jasem Mutlaq committed
19
20
#include "opsekos.h"
#include "Options.h"
21
#include "kstarsdata.h"
22
#include "ekosmanager.h"
23
#include "guide/guide.h"
24
#include "fov.h"
25

26
OpsEkos::OpsEkos()
27
        : QTabWidget( KStars::Instance() )
28
29
{
    setupUi(this);
30

31
32
33
    //Get a pointer to the KConfigDialog
    m_ConfigDialog = KConfigDialog::exists( "settings" );

Robert Lancaster's avatar
Robert Lancaster committed
34
#ifdef Q_OS_OSX
Robert Lancaster's avatar
Robert Lancaster committed
35
36
37
connect(kcfg_astrometrySolverIsInternal, SIGNAL(clicked()), this, SLOT(toggleSolverInternal()));
kcfg_astrometrySolverIsInternal->setToolTip(i18n("Internal or External Plate Solver?"));
if(Options::astrometrySolverIsInternal())
Robert Lancaster's avatar
Robert Lancaster committed
38
    kcfg_astrometrySolver->setEnabled(false);
Robert Lancaster's avatar
Robert Lancaster committed
39

Robert Lancaster's avatar
Robert Lancaster committed
40
41
42
connect(kcfg_astrometryConfFileIsInternal, SIGNAL(clicked()), this, SLOT(toggleConfigInternal()));
kcfg_astrometryConfFileIsInternal->setToolTip(i18n("Internal or External astrometry.cfg?"));
if(Options::astrometryConfFileIsInternal())
Robert Lancaster's avatar
Robert Lancaster committed
43
    kcfg_astrometryConfFile->setEnabled(false);
Robert Lancaster's avatar
Robert Lancaster committed
44

Robert Lancaster's avatar
Robert Lancaster committed
45
46
47
connect(kcfg_wcsIsInternal, SIGNAL(clicked()), this, SLOT(toggleWCSInternal()));
kcfg_wcsIsInternal->setToolTip(i18n("Internal or External wcsinfo?"));
if(Options::wcsIsInternal())
Robert Lancaster's avatar
Robert Lancaster committed
48
    kcfg_astrometryWCSInfo->setEnabled(false);
Robert Lancaster's avatar
Robert Lancaster committed
49
#else
Robert Lancaster's avatar
Robert Lancaster committed
50
51
52
kcfg_astrometrySolverIsInternal->setVisible(false);
kcfg_astrometryConfFileIsInternal->setVisible(false);
kcfg_wcsIsInternal->setVisible(false);
Robert Lancaster's avatar
Robert Lancaster committed
53
54
#endif

Jasem Mutlaq's avatar
Jasem Mutlaq committed
55
    connect( m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL( clicked() ), SLOT( slotApply() ) );
Jasem Mutlaq's avatar
Jasem Mutlaq committed
56
    connect( m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL( clicked() ), SLOT( slotApply() ) );    
57
58
59
60
61
}


OpsEkos::~OpsEkos() {}

Robert Lancaster's avatar
Robert Lancaster committed
62
63
void OpsEkos::toggleSolverInternal()
{
Robert Lancaster's avatar
Robert Lancaster committed
64
65
    kcfg_astrometrySolver->setEnabled(!kcfg_astrometrySolverIsInternal->isChecked());
    if(kcfg_astrometrySolverIsInternal->isChecked())
Robert Lancaster's avatar
Robert Lancaster committed
66
67
68
69
70
71
72
        kcfg_astrometrySolver->setText("*Internal Solver*");
    else
        kcfg_astrometrySolver->setText("/usr/local/bin/solve-field");
}

void OpsEkos::toggleConfigInternal()
{
Robert Lancaster's avatar
Robert Lancaster committed
73
74
    kcfg_astrometryConfFile->setEnabled(!kcfg_astrometryConfFileIsInternal->isChecked());
    if(kcfg_astrometryConfFileIsInternal->isChecked())
Robert Lancaster's avatar
Robert Lancaster committed
75
76
77
78
79
80
81
        kcfg_astrometryConfFile->setText("*Internal astrometry.cfg*");
    else
        kcfg_astrometryConfFile->setText("/etc/astrometry.cfg");
}

void OpsEkos::toggleWCSInternal()
{
Robert Lancaster's avatar
Robert Lancaster committed
82
83
    kcfg_astrometryWCSInfo->setEnabled(!kcfg_wcsIsInternal->isChecked());
    if(kcfg_wcsIsInternal->isChecked())
Robert Lancaster's avatar
Robert Lancaster committed
84
85
86
87
88
        kcfg_astrometryWCSInfo->setText("*Internal wcsinfo*");
    else
        kcfg_astrometryWCSInfo->setText("/usr/local/bin/wcsinfo");
}

89
90
void OpsEkos::slotApply()
{
91
    EkosManager *ekosManager = KStars::Instance()->ekosManager();
92

93
    if (ekosManager)
94
    {
95
96
97
98
        Ekos::Align *alignModule = ekosManager->alignModule();

        if (alignModule && alignModule->fov())
            alignModule->fov()->setImageDisplay(kcfg_SolverWCS->isChecked());
99
    }
100
}