• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 15291774563

28 May 2025 04:48AM UTC coverage: 11.932% (-0.02%) from 11.952%
15291774563

push

github

alex-w
Fix comet discovery data

14635 of 122658 relevant lines covered (11.93%)

18292.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/plugins/ArchaeoLines/src/gui/ArchaeoLinesDialogLocations.cpp
1
/*
2
 * ArchaeoLines plug-in for Stellarium
3
 *
4
 * Copyright (C) 2021 Georg Zotti
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
 */
19

20
#include "ArchaeoLines.hpp"
21
#include "ArchaeoLinesDialogLocations.hpp"
22
#include "ui_archaeoLinesDialogLocations.h"
23

24
#include "StelApp.hpp"
25
#include "StelGui.hpp"
26
#include "StelLocationMgr.hpp"
27
#include "StelModule.hpp"
28
#include "StelModuleMgr.hpp"
29

30
ArchaeoLinesDialogLocations::ArchaeoLinesDialogLocations()
×
31
        : StelDialog("ArchaeoLinesLocations")
32
        , al(Q_NULLPTR)
×
33
        , modalContext(0)
×
34
        , allModel(new QStringListModel(this))
×
35
        , pickedModel(new QStringListModel(this))
×
36
        , proxyModel(nullptr)
×
37
{
38
        ui = new Ui_archaeoLinesDialogLocations();
×
39
}
×
40

41
ArchaeoLinesDialogLocations::~ArchaeoLinesDialogLocations()
×
42
{
43
        delete ui;          ui=Q_NULLPTR;
×
44
}
×
45

46
void ArchaeoLinesDialogLocations::retranslate()
×
47
{
48
        if (dialog)
×
49
        {
50
                ui->retranslateUi(dialog);
×
51
        }
52
}
×
53

54
void ArchaeoLinesDialogLocations::createDialogContent()
×
55
{
56
        al = GETSTELMODULE(ArchaeoLines);
×
57
        ui->setupUi(dialog);
×
58

59
        // Kinetic scrolling
60
        kineticScrollingList << ui->citiesListView;
×
61
        StelGui* gui= static_cast<StelGui*>(StelApp::getInstance().getGui());
×
62
        enableKineticScrolling(gui->getFlagUseKineticScrolling());
×
63
        connect(gui, SIGNAL(flagUseKineticScrollingChanged(bool)), this, SLOT(enableKineticScrolling(bool)));
×
64

65
        connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
×
66
        connect(ui->titleBar, &TitleBar::closeClicked, this, &StelDialog::close);
×
67
        connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
×
68

69
        //initialize list model
70
        StelLocationMgr *locMgr=&(StelApp::getInstance().getLocationMgr());
×
71
        connect(locMgr, SIGNAL(locationListChanged()), this, SLOT(reloadLocations()));
×
72
        reloadLocations();
×
73
        proxyModel = new QSortFilterProxyModel(ui->citiesListView);
×
74
        proxyModel->setSourceModel(allModel);
×
75
        proxyModel->sort(0, Qt::AscendingOrder);
×
76
        proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
×
77
        ui->citiesListView->setModel(proxyModel);
×
78

79
        connect(ui->citySearchLineEdit, SIGNAL(textChanged(const QString&)), proxyModel, SLOT(setFilterWildcard(const QString&)));
×
80
        connect(ui->citiesListView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(setLocationFromList(const QModelIndex&)));
×
81
}
×
82

83
void ArchaeoLinesDialogLocations::setLocationFromList(const QModelIndex& index)
×
84
{
85
        StelLocation loc = StelApp::getInstance().getLocationMgr().locationForString(index.data().toString());
×
86
        switch (modalContext)
×
87
        {
88
                case 1:
×
89
                        al->setGeographicLocation1Latitude(static_cast<double>(loc.getLatitude()));
×
90
                        al->setGeographicLocation1Longitude(static_cast<double>(loc.getLongitude()));
×
91
                        al->setGeographicLocation1Label(loc.name);
×
92
                        break;
×
93
                case 2:
×
94
                        al->setGeographicLocation2Latitude(static_cast<double>(loc.getLatitude()));
×
95
                        al->setGeographicLocation2Longitude(static_cast<double>(loc.getLongitude()));
×
96
                        al->setGeographicLocation2Label(loc.name);
×
97
                        break;
×
98
                default:
×
99
                        // do nothing
100
                        break;
×
101
        }
102
}
×
103

104
// Connected to the button
105
void ArchaeoLinesDialogLocations::setLocationFromList()
×
106
{
107
        QModelIndex index=ui->citiesListView->currentIndex();
×
108
        setLocationFromList(index);
×
109
}
×
110

111
void ArchaeoLinesDialogLocations::reloadLocations()
×
112
{
113
        allModel->setStringList(StelApp::getInstance().getLocationMgr().getAllMap().keys());
×
114
}
×
115

116
void ArchaeoLinesDialogLocations::setModalContext(int context)
×
117
{
118
        modalContext=context;
×
119
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc