opsekos.cpp 2.89 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.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" );

34
    selectPHD2B->setIcon(QIcon::fromTheme("document-open", QIcon(":/icons/breeze/default/document-open.png")));
35

Jasem Mutlaq's avatar
Jasem Mutlaq committed
36
37
38
    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() ) );
39
    connect( selectPHD2B, SIGNAL(clicked()), this, SLOT(slotSelectPHD2Exec()));
40
    connect( kcfg_UseEkosGuider, SIGNAL(toggled(bool)), this, SLOT(slotCheckGuideModule()));
41

42
43
44
45
46
47
48
}


OpsEkos::~OpsEkos() {}

void OpsEkos::slotApply()
{
49
    EkosManager *ekosManager = KStars::Instance()->ekosManager();
50

51
    if (ekosManager)
52
    {
53
        //ekosManager->refreshRemoteDrivers();
54
55
56
57
58

        Ekos::Guide *guideModule = ekosManager->guideModule();

        if (guideModule)
            guideModule->setGuiderProcess(kcfg_UseEkosGuider->isChecked() ? Ekos::Guide::GUIDE_INTERNAL : Ekos::Guide::GUIDE_PHD2);
59
60
61
62
63

        Ekos::Align *alignModule = ekosManager->alignModule();

        if (alignModule && alignModule->fov())
            alignModule->fov()->setImageDisplay(kcfg_SolverWCS->isChecked());
64
    }
65
66
67
68
}

void OpsEkos::slotCancel()
{
69
}
70

71
72
73
74
75
76
void OpsEkos::slotSelectPHD2Exec()
{
    QUrl phd2URL = QFileDialog::getOpenFileUrl(this, i18n("Select PHD2 Executable"));
    if (phd2URL.isEmpty())
        return;

77
    kcfg_PHD2Exec->setText(phd2URL.toLocalFile());
78
79
}

80
81
82
void OpsEkos::slotCheckGuideModule()
{
    EkosManager *ekosManager = KStars::Instance()->ekosManager();
83

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
    if (ekosManager)
    {
        Ekos::Guide *guideModule = ekosManager->guideModule();

        if (guideModule == NULL)
            return;

        if (guideModule->isCalibrating() || guideModule->isGuiding())
        {
           kcfg_UseEkosGuider->disconnect();
           kcfg_UseEkosGuider->setChecked(!kcfg_UseEkosGuider->isChecked());
           connect( kcfg_UseEkosGuider, SIGNAL(toggled(bool)), this, SLOT(slotCheckGuideModule()));

           KMessageBox::error(KStars::Instance(), i18n("Cannot change guider while guiding process is busy."));
        }
    }
}