opsekos.cpp 3.3 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
56
57
    connect( m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL( clicked() ), SLOT( slotApply() ) );
    connect( m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL( clicked() ), SLOT( slotApply() ) );
    connect( m_ConfigDialog->button(QDialogButtonBox::Cancel), SIGNAL( clicked() ), SLOT( slotCancel() ) );
58
59
60
61
62
}


OpsEkos::~OpsEkos() {}

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

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

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

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

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

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