summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Fedoskin <afedoskin3@gmail.com>2016-08-22 14:07:27 (GMT)
committerArtem Fedoskin <afedoskin3@gmail.com>2016-08-22 14:07:27 (GMT)
commite498f19a762b431787dd2f5a0d0c9f4a502bcec9 (patch)
treeb1df82740fddb3401ac14aca92db9cdbc6556a0d
parenta520f0eca43caa9ffbe06271d2f063cd8bcc6486 (diff)
Added "Set Geolocation" page. User can set location either manualy or by
getting latitude and longitude from device sensors (GPS, Wi-Fi etc.). Changed the structure of QML part of the project.
-rw-r--r--CMakeLists.txt2
-rw-r--r--apk/AndroidManifest.xml1
-rw-r--r--kstars/CMakeLists.txt16
-rw-r--r--kstars/dialogs/locationdialog.cpp10
-rw-r--r--kstars/kstarsdata.h1
-rw-r--r--kstars/kstarslite.cpp6
-rw-r--r--kstars/kstarslite.h4
-rw-r--r--kstars/kstarslite/dialogs/detaildialoglite.cpp4
-rw-r--r--kstars/kstarslite/dialogs/finddialoglite.cpp119
-rw-r--r--kstars/kstarslite/dialogs/finddialoglite.h12
-rw-r--r--kstars/kstarslite/dialogs/locationdialoglite.cpp443
-rw-r--r--kstars/kstarslite/dialogs/locationdialoglite.h109
-rw-r--r--kstars/kstarslite/dialogs/skyobjectlistmodel.cpp2
-rw-r--r--kstars/kstarslite/dialogs/skyobjectlistmodel.h12
-rw-r--r--kstars/kstarslite/qml/CMakeLists.txt18
-rw-r--r--kstars/kstarslite/qml/dialogs/DetailsDialog.qml (renamed from kstars/kstarslite/qml/modules/ObjectDetails.qml)16
-rw-r--r--kstars/kstarslite/qml/dialogs/FindDialog.qml2
-rw-r--r--kstars/kstarslite/qml/dialogs/LocationDialog.qml131
-rw-r--r--kstars/kstarslite/qml/dialogs/helpers/DetailsAddLink.qml (renamed from kstars/kstarslite/qml/modules/popups/AddLinkPopup.qml)13
-rw-r--r--kstars/kstarslite/qml/dialogs/helpers/DetailsItem.qml (renamed from kstars/kstarslite/qml/modules/helpers/DetailsItem.qml)0
-rw-r--r--kstars/kstarslite/qml/dialogs/helpers/LocationEdit.qml330
-rw-r--r--kstars/kstarslite/qml/dialogs/helpers/LocationLoading.qml45
-rw-r--r--kstars/kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml (renamed from kstars/kstarslite/qml/modules/popups/LinkMenu.qml)5
-rw-r--r--kstars/kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml82
-rw-r--r--kstars/kstarslite/qml/main.qml116
-rw-r--r--kstars/kstarslite/qml/modules/KSListView.qml15
-rw-r--r--kstars/kstarslite/qml/modules/helpers/PassiveNotification.qml8
-rw-r--r--kstars/kstarslite/qml/modules/menus/ContextMenu.qml6
-rw-r--r--kstars/kstarsliteinit.cpp2
-rw-r--r--kstars/main.cpp10
30 files changed, 1288 insertions, 252 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed2b685..8276311 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
if(BUILD_KSTARS_LITE)
- find_package(Qt5 5.7 REQUIRED COMPONENTS Gui Qml Quick QuickControls2 Xml Svg Sql Network Sensors)
+ find_package(Qt5 5.7 REQUIRED COMPONENTS Gui Qml Quick QuickControls2 Xml Svg Sql Network Sensors Positioning)
else()
find_package(Qt5 5.4 REQUIRED COMPONENTS Gui Qml Quick Xml Sql Svg Network PrintSupport)
endif()
diff --git a/apk/AndroidManifest.xml b/apk/AndroidManifest.xml
index 3e97ad0..28ffca2 100644
--- a/apk/AndroidManifest.xml
+++ b/apk/AndroidManifest.xml
@@ -38,6 +38,7 @@
</activity>
</application>
<supports-screens android:anyDensity="true" android:normalScreens="true" android:smallScreens="true" android:largeScreens="true"/>
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index ba66220..789fa36 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -585,6 +585,7 @@ if(BUILD_KSTARS_LITE)
#Dialogs
kstarslite/dialogs/detaildialoglite.cpp
kstarslite/dialogs/finddialoglite.cpp
+ kstarslite/dialogs/locationdialoglite.cpp
kstarslite/dialogs/skyobjectlistmodel.cpp
#RootNode
kstarslite/skyitems/rootnode.cpp
@@ -668,23 +669,29 @@ if(BUILD_KSTARS_LITE)
kstarslite/qml/modules/Splash.qml
kstarslite/qml/modules/helpers/TimeSpinBox.qml
kstarslite/qml/modules/TimePage.qml
- kstarslite/qml/modules/ObjectDetails.qml
kstarslite/qml/modules/KSTab.qml
#Popups
kstarslite/qml/modules/popups/ProjectionsPopup.qml
kstarslite/qml/modules/popups/FOVPopup.qml
kstarslite/qml/modules/popups/ColorSchemePopup.qml
- kstarslite/qml/modules/popups/AddLinkPopup.qml
- kstarslite/qml/modules/popups/LinkMenu.qml
#Menus
kstarslite/qml/modules/menus/ContextMenu.qml
#Helpers
kstarslite/qml/modules/helpers/PassiveNotification.qml
kstarslite/qml/modules/helpers/KSMenuItem.qml
- kstarslite/qml/modules/helpers/DetailsItem.qml
kstarslite/qml/modules/helpers/TelescopeControl.qml
#Dialogs
kstarslite/qml/dialogs/FindDialog.qml
+ kstarslite/qml/dialogs/LocationDialog.qml
+ kstarslite/qml/dialogs/DetailsDialog.qml
+
+ kstarslite/qml/dialogs/helpers/DetailsItem.qml
+ kstarslite/qml/dialogs/helpers/DetailsAddLink.qml
+ kstarslite/qml/dialogs/helpers/LocationEdit.qml
+ kstarslite/qml/dialogs/helpers/LocationLoading.qml
+
+ kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml
+ kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml
#INDI
kstarslite/qml/indi/INDIControlPanel.qml
kstarslite/qml/indi/DevicePanel.qml
@@ -828,6 +835,7 @@ if(BUILD_KSTARS_LITE)
Qt5::Quick
Qt5::Sensors
Qt5::QuickControls2
+ Qt5::Positioning
${ZLIB_LIBRARIES}
)
if(INDI_FOUND)
diff --git a/kstars/dialogs/locationdialog.cpp b/kstars/dialogs/locationdialog.cpp
index 146f2f9..f47d842 100644
--- a/kstars/dialogs/locationdialog.cpp
+++ b/kstars/dialogs/locationdialog.cpp
@@ -488,6 +488,16 @@ bool LocationDialog::checkLongLat() {
return true;
}
+dms LocationDialog::createDms ( bool deg, bool *ok )
+{
+ dms dmsAngle(0.0); // FIXME: Should we change this to NaN?
+ bool check;
+ check = dmsAngle.setFromString( text(), deg );
+ if (ok) *ok = check; //ok might be a null pointer!
+
+ return dmsAngle;
+}
+
void LocationDialog::clearFields()
{
ld->CityFilter->clear();
diff --git a/kstars/kstarsdata.h b/kstars/kstarsdata.h
index 3236464..b3b0f12 100644
--- a/kstars/kstarsdata.h
+++ b/kstars/kstarsdata.h
@@ -92,6 +92,7 @@ public:
friend class SkyMap;
// FIXME: uses geoList and changes it.
friend class LocationDialog;
+ friend class LocationDialogLite;
static KStarsData* Create( );
diff --git a/kstars/kstarslite.cpp b/kstars/kstarslite.cpp
index 44bcb34..53dc22d 100644
--- a/kstars/kstarslite.cpp
+++ b/kstars/kstarslite.cpp
@@ -33,9 +33,10 @@
#include "kspaths.h"
-//Dialog
+//Dialogs
#include "kstarslite/dialogs/finddialoglite.h"
#include "kstarslite/dialogs/detaildialoglite.h"
+#include "kstarslite/dialogs/locationdialoglite.h"
#include "Options.h"
#include "ksutils.h"
@@ -76,8 +77,11 @@ KStarsLite::KStarsLite( bool doSplash, bool startClock, const QString &startDate
//Dialogs
m_findDialogLite = new FindDialogLite;
m_detailDialogLite = new DetailDialogLite;
+ m_locationDialogLite = new LocationDialogLite;
+
m_Engine.rootContext()->setContextProperty("FindDialogLite", m_findDialogLite);
m_Engine.rootContext()->setContextProperty("DetailDialogLite", m_detailDialogLite);
+ m_Engine.rootContext()->setContextProperty("LocationDialogLite", m_locationDialogLite);
//Set Geographic Location from Options
m_KStarsData->setLocationFromOptions();
diff --git a/kstars/kstarslite.h b/kstars/kstarslite.h
index 476d1cf..a236031 100644
--- a/kstars/kstarslite.h
+++ b/kstars/kstarslite.h
@@ -34,6 +34,7 @@ class ImageProvider;
class FindDialogLite;
class DetailDialogLite;
+class LocationDialogLite;
#ifdef INDI_FOUND
class ClientManagerLite;
@@ -203,7 +204,8 @@ private:
//Dialogs
FindDialogLite *m_findDialogLite;
DetailDialogLite *m_detailDialogLite;
-
+ LocationDialogLite *m_locationDialogLite;
+
#ifdef INDI_FOUND
ClientManagerLite *m_clientManager;
#endif
diff --git a/kstars/kstarslite/dialogs/detaildialoglite.cpp b/kstars/kstarslite/dialogs/detaildialoglite.cpp
index f62f275..c495ccf 100644
--- a/kstars/kstarslite/dialogs/detaildialoglite.cpp
+++ b/kstars/kstarslite/dialogs/detaildialoglite.cpp
@@ -584,6 +584,8 @@ void DetailDialogLite::updateLocalDatabase(int type, const QString &search_line,
void DetailDialogLite::addLink(QString url, QString desc, bool isImageLink) {
SkyObject *selectedObject = SkyMapLite::Instance()->getClickedObjectLite()->getObject();
+ if(url.isEmpty() || desc.isEmpty()) return; //Do nothing if empty url or desc were provided
+
QString entry;
QFile file;
@@ -691,6 +693,8 @@ void DetailDialogLite::editLink(int itemIndex, bool isImage, QString desc, QStri
{
SkyObject *selectedObject = SkyMapLite::Instance()->getClickedObjectLite()->getObject();
+ if(url.isEmpty() || desc.isEmpty()) return; //Do nothing if empty url or desc were provided
+
QString search_line, replace_line, currentItemTitle, currentItemURL;
//Check if it is a valid index
diff --git a/kstars/kstarslite/dialogs/finddialoglite.cpp b/kstars/kstarslite/dialogs/finddialoglite.cpp
index 06128d2..3313bff 100644
--- a/kstars/kstarslite/dialogs/finddialoglite.cpp
+++ b/kstars/kstarslite/dialogs/finddialoglite.cpp
@@ -64,46 +64,6 @@ FindDialogLite::FindDialogLite( ) :
FindDialogLite::~FindDialogLite() { }
-/*void FindDialogLite::initSelection() {
- if ( m_sortModel->rowCount() <= 0 )
- {
- return;
- }
-
- //if ( ui->SearchBox->text().isEmpty() ) {
- //Pre-select the first item
- QModelIndex selectItem = m_sortModel->index( 0, m_sortModel->filterKeyColumn(), QModelIndex() );
- switch ( 0) {//ui->FilterType->currentIndex() ) {
- case 0: //All objects, choose Andromeda galaxy
- {
- QModelIndex qmi = fModel->index( fModel->stringList().indexOf( i18n("Andromeda Galaxy") ) );
- selectItem = m_sortModel->mapFromSource( qmi );
- break;
- }
- case 1: //Stars, choose Aldebaran
- {
- QModelIndex qmi = fModel->index( fModel->stringList().indexOf( i18n("Aldebaran") ) );
- selectItem = m_sortModel->mapFromSource( qmi );
- break;
- }
- case 2: //Solar system or Asteroids, choose Aaltje
- case 9:
- {
- QModelIndex qmi = fModel->index( fModel->stringList().indexOf( i18n("Aaltje") ) );
- selectItem = m_sortModel->mapFromSource( qmi );
- break;
- }
- case 8: //Comets, choose 'Aarseth-Brewington (1989 W1)'
- {
- QModelIndex qmi = fModel->index( fModel->stringList().indexOf( i18n("Aarseth-Brewington (1989 W1)") ) );
- selectItem = m_sortModel->mapFromSource( qmi );
- break;
- }
-
- }
- //listFiltered = true;
-}*/
-
void FindDialogLite::filterByType(uint typeIndex) {
KStarsData *data = KStarsData::Instance();
@@ -172,20 +132,6 @@ void FindDialogLite::filterByType(uint typeIndex) {
void FindDialogLite::filterList(QString searchQuery) {
QString SearchText = processSearchText(searchQuery);
m_sortModel->setFilterFixedString( SearchText );
- //filterByType();
- //initSelection();
-
- //Select the first item in the list that begins with the filter string
- /*if ( !SearchText.isEmpty() ) {
- QStringList mItems = fModel->stringList().filter( QRegExp( '^'+SearchText, Qt::CaseInsensitive ) );
- mItems.sort();
-
- if ( mItems.size() ) {
- QModelIndex qmi = fModel->index( fModel->stringList().indexOf( mItems[0] ) );
- QModelIndex selectItem = m_sortModel->mapFromSource( qmi );
- }
- }*/
-
listFiltered = true;
}
@@ -195,18 +141,6 @@ void FindDialogLite::selectObject(int index) {
SkyMapLite::Instance()->slotSelectObject(skyObj);
}
-void FindDialogLite::enqueueSearch() {
- /*listFiltered = false;
- if ( timer ) {
- timer->stop();
- } else {
- timer = new QTimer( this );
- timer->setSingleShot( true );
- connect( timer, SIGNAL( timeout() ), this, SLOT( filterList() ) );
- }
- timer->start( 500 );*/
-}
-
// Process the search box text to replace equivalent names like "m93" with "m 93"
QString FindDialogLite::processSearchText(QString text) {
QRegExp re;
@@ -231,56 +165,3 @@ QString FindDialogLite::processSearchText(QString text) {
return searchtext;
}
-
-void FindDialogLite::slotOk() {
- /*//If no valid object selected, show a sorry-box. Otherwise, emit accept()
- SkyObject *selObj;
- if(!listFiltered) {
- filterList();
- }
- selObj = selectedObject();
- if ( selObj == 0 ) {
- QString message = i18n( "No object named %1 found.", ui->SearchBox->text() );
- //KMessageBox::sorry( 0, message, i18n( "Bad object name" ) );
- } else {
- accept();
- }*/
-}
-
-/*void FindDialogLite::keyPressEvent( QKeyEvent *e ) {
- switch( e->key() ) {
- case Qt::Key_Escape :
- reject();
- break;
- case Qt::Key_Up :
- {
- int currentRow = ui->SearchList->currentIndex().row();
- if ( currentRow > 0 ) {
- QModelIndex selectItem = m_sortModel->index( currentRow-1, m_sortModel->filterKeyColumn(), QModelIndex() );
- ui->SearchList->selectionModel()->setCurrentIndex( selectItem, QItemSelectionModel::SelectCurrent );
- }
- break;
- }
- case Qt::Key_Down :
- {
- int currentRow = ui->SearchList->currentIndex().row();
- if ( currentRow < m_sortModel->rowCount()-1 ) {
- QModelIndex selectItem = m_sortModel->index( currentRow+1, m_sortModel->filterKeyColumn(), QModelIndex() );
- ui->SearchList->selectionModel()->setCurrentIndex( selectItem, QItemSelectionModel::SelectCurrent );
- }
- break;
- }
- }
-}*/
-
-void FindDialogLite::slotDetails()
-{
- /*if ( selectedObject() ) {
- QPointer<DetailDialog> dd = new DetailDialog( selectedObject(), KStarsData::Instance()->ut(), KStarsData::Instance()->geo(), KStars::Instance());
- dd->exec();
- delete dd;
- }*/
-
-}
-
-
diff --git a/kstars/kstarslite/dialogs/finddialoglite.h b/kstars/kstarslite/dialogs/finddialoglite.h
index f3109af..feaf617 100644
--- a/kstars/kstarslite/dialogs/finddialoglite.h
+++ b/kstars/kstarslite/dialogs/finddialoglite.h
@@ -60,18 +60,6 @@ public slots:
*/
Q_INVOKABLE void filterList(QString searchQuery);
- //FIXME: Still valid for QDialog? i.e., does QDialog have a slotOk() ?
- /**
- *Overloading the Standard QDialogBase slotOk() to show a "sorry" message
- *box if no object is selected when the user presses Ok. The window is
- *not closed in this case.
- */
- void slotOk();
-
-private slots:
- void enqueueSearch();
-
- void slotDetails();
private:
/** @short Do some post processing on the search text to interpret what the user meant
diff --git a/kstars/kstarslite/dialogs/locationdialoglite.cpp b/kstars/kstarslite/dialogs/locationdialoglite.cpp
new file mode 100644
index 0000000..460ca59
--- /dev/null
+++ b/kstars/kstarslite/dialogs/locationdialoglite.cpp
@@ -0,0 +1,443 @@
+´╗┐/***************************************************************************
+ locationialoglite.cpp - K Desktop Planetarium
+ -------------------
+ begin : Sun Aug 21 2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * This program 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. *
+ * *
+ ***************************************************************************/
+
+#include "locationdialoglite.h"
+#include "kstarsdata.h"
+#include "kstarslite.h"
+#include <QQmlContext>
+#include "kspaths.h"
+
+LocationDialogLite::LocationDialogLite()
+ :SelectedCity(nullptr), currentGeo(nullptr){
+ // KStarsData* data = KStarsData::Instance();
+
+ // SelectedCity = NULL;
+
+ // setWindowTitle( i18n( "Set Geographic Location" ) );
+
+ // QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
+ // mainLayout->addWidget(buttonBox);
+ // connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOk()));
+ // connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+ // for ( int i=0; i<25; ++i )
+ // ld->TZBox->addItem( QLocale().toString( (double)(i-12) ) );
+
+ // //Populate DSTRuleBox
+ // foreach( const QString& key, data->getRulebook().keys() ) {
+ // if( !key.isEmpty() )
+ // ld->DSTRuleBox->addItem( key );
+ // }
+
+ // /*ld->DSTLabel->setText( "<a href=\"showrules\">" + i18n("DST Rule:") + "</a>" );
+ // connect( ld->DSTLabel, SIGNAL( linkActivated(const QString &) ), this, SLOT( showTZRules() ) );*/
+ KStarsLite *kstars = KStarsLite::Instance();
+ kstars->qmlEngine()->rootContext()->setContextProperty("CitiesModel", &m_cityList);
+
+ //initialize cities once KStarsData finishes loading everything
+ connect(kstars, SIGNAL(dataLoadFinished()), this, SLOT(initCityList()));
+ KStarsData* data = KStarsData::Instance();
+ connect(data, SIGNAL(geoChanged()), this, SLOT(updateCurrentLocation()));
+}
+
+void LocationDialogLite::initCityList() {
+ KStarsData* data = KStarsData::Instance();
+ QStringList cities;
+ foreach ( GeoLocation *loc, data->getGeoList() )
+ {
+ QString name = loc->fullName();
+ cities.append( name );
+ filteredCityList.insert( name, loc );
+
+ //If TZ is not an even integer value, add it to listbox
+ /*if ( loc->TZ0() - int( loc->TZ0() ) && m_TZList.indexOf( QLocale().toString( loc->TZ0() ) ) != -1 ) {
+ for ( int i=0; i < m_TZList.size(); ++i ) {
+ if ( m_TZList[i].toDouble() > loc->TZ0() ) {
+ ld->TZBox->addItem( QLocale().toString( loc->TZ0() ), i-1 );
+ break;
+ }
+ }
+ }*/
+ }
+
+ //Sort the list of Cities alphabetically...note that filteredCityList may now have a different ordering!
+ m_cityList.setStringList(cities);
+ m_cityList.sort(0);
+
+ //ld->CountLabel->setText( i18np("One city matches search criteria","%1 cities match search criteria", ld->GeoBox->count()) );
+
+ // attempt to highlight the current kstars location in the GeoBox
+ /*ld->GeoBox->setCurrentItem( 0 );
+ for( int i=0; i < ld->GeoBox->count(); i++ ) {
+ if ( ld->GeoBox->item(i)->text() == data->geo()->fullName() ) {
+ ld->GeoBox->setCurrentRow( i );
+ break;
+ }
+ }*/
+
+ QStringList TZ;
+
+ for ( int i=0; i<25; ++i )
+ TZ.append( QLocale().toString( (double)(i-12) ) );
+ setProperty("TZList",TZ);
+
+ QStringList DST;
+
+ foreach( const QString& key, data->getRulebook().keys() ) {
+ if( !key.isEmpty() )
+ DST.append( key );
+ }
+ setProperty("DSTRules",DST);
+}
+
+void LocationDialogLite::filterCity(QString city, QString province, QString country) {
+ KStarsData* data = KStarsData::Instance();
+ QStringList cities;
+ filteredCityList.clear();
+
+ /*nameModified = false;
+ dataModified = false;
+ ld->AddCityButton->setEnabled( false );
+ ld->UpdateButton->setEnabled( false );*/
+
+ foreach ( GeoLocation *loc, data->getGeoList() ) {
+ QString sc( loc->translatedName() );
+ QString ss( loc->translatedCountry() );
+ QString sp = "";
+ if ( !loc->province().isEmpty() )
+ sp = loc->translatedProvince();
+
+ if ( sc.toLower().startsWith( city.toLower() ) &&
+ sp.toLower().startsWith( province.toLower() ) &&
+ ss.toLower().startsWith( country.toLower() ) ) {
+ QString name = loc->fullName();
+ cities.append( name );
+ filteredCityList.insert( name, loc );
+ }
+ }
+ m_cityList.setStringList(cities);
+ m_cityList.sort(0);
+ setProperty("currLocIndex", m_cityList.stringList().indexOf(m_currentLocation));
+
+ //ld->CountLabel->setText( i18np("One city matches search criteria","%1 cities match search criteria", ld->GeoBox->count()) );
+}
+
+bool LocationDialogLite::addCity(QString city, QString province, QString country, QString latitude, QString longitude, QString TimeZoneString, QString TZRule) {
+ QSqlDatabase mycitydb = getDB();
+
+ if( mycitydb.isValid() ) {
+ bool latOk(false), lngOk(false), tzOk(false);
+ dms lat = createDms( latitude, true, &latOk );
+ dms lng = createDms( longitude, true, &lngOk );
+ //TimeZoneString.replace( QLocale().decimalPoint(), "." );
+ double TZ = TimeZoneString.toDouble( &tzOk );
+
+ if ( ! latOk || ! lngOk || !tzOk) return false;
+
+ //Strip off white space
+ city = city.trimmed();
+ province = province.trimmed();
+ country = country.trimmed();
+ GeoLocation *g = NULL;
+
+ QSqlQuery add_query(mycitydb);
+ add_query.prepare("INSERT INTO city(Name, Province, Country, Latitude, Longitude, TZ, TZRule) VALUES(:Name, :Province, :Country, :Latitude, :Longitude, :TZ, :TZRule)");
+ add_query.bindValue(":Name", city);
+ add_query.bindValue(":Province", province);
+ add_query.bindValue(":Country", country);
+ add_query.bindValue(":Latitude", lat.toDMSString());
+ add_query.bindValue(":Longitude", lng.toDMSString());
+ add_query.bindValue(":TZ", TZ);
+ add_query.bindValue(":TZRule", TZRule);
+ if (add_query.exec() == false)
+ {
+ qWarning() << add_query.lastError() << endl;
+ return false;
+ }
+
+ //Add city to geoList
+ g = new GeoLocation( lng, lat, city, province, country, TZ, & KStarsData::Instance()->Rulebook[ TZRule ] );
+ KStarsData::Instance()->getGeoList().append(g);
+
+ mycitydb.commit();
+ mycitydb.close();
+ return true;
+ }
+
+ return false;
+}
+
+bool LocationDialogLite::deleteCity(QString fullName) {
+ QSqlDatabase mycitydb = getDB();
+ GeoLocation *geo = filteredCityList.value(fullName);
+
+ if( mycitydb.isValid() && geo && !geo->isReadOnly()) {
+ QSqlQuery delete_query(mycitydb);
+ delete_query.prepare("DELETE FROM city WHERE Name = :Name AND Province = :Province AND Country = :Country");
+ delete_query.bindValue(":Name", geo->name());
+ delete_query.bindValue(":Province", geo->province());
+ delete_query.bindValue(":Country", geo->country());
+ if (delete_query.exec() == false)
+ {
+ qWarning() << delete_query.lastError() << endl;
+ return false;
+ }
+
+ filteredCityList.remove(geo->fullName());
+ KStarsData::Instance()->getGeoList().removeOne(geo);
+ delete(geo);
+ mycitydb.commit();
+ mycitydb.close();
+ return true;
+ }
+ return false;
+}
+
+bool LocationDialogLite::editCity(QString fullName, QString city, QString province, QString country, QString latitude, QString longitude, QString TimeZoneString, QString TZRule) {
+ QSqlDatabase mycitydb = getDB();
+ GeoLocation *geo = filteredCityList.value(fullName);
+ KStarsData *data = KStarsData::Instance();
+
+ bool latOk(false), lngOk(false), tzOk(false);
+ dms lat = createDms( latitude, true, &latOk );
+ dms lng = createDms( longitude, true, &lngOk );
+ double TZ = TimeZoneString.toDouble( &tzOk );
+
+ if( mycitydb.isValid() && geo && !geo->isReadOnly() && latOk && lngOk && tzOk) {
+ QSqlQuery update_query(mycitydb);
+ update_query.prepare("UPDATE city SET Name = :newName, Province = :newProvince, Country = :newCountry, Latitude = :Latitude, Longitude = :Longitude, TZ = :TZ, TZRule = :TZRule WHERE "
+ "Name = :Name AND Province = :Province AND Country = :Country");
+ update_query.bindValue(":newName", city);
+ update_query.bindValue(":newProvince", province);
+ update_query.bindValue(":newCountry", country);
+ update_query.bindValue(":Name", geo->name());
+ update_query.bindValue(":Province", geo->province());
+ update_query.bindValue(":Country", geo->country());
+ update_query.bindValue(":Latitude", lat.toDMSString());
+ update_query.bindValue(":Longitude", lng.toDMSString());
+ update_query.bindValue(":TZ", TZ);
+ update_query.bindValue(":TZRule", TZRule);
+ if (update_query.exec() == false)
+ {
+ qWarning() << update_query.lastError() << endl;
+ return false;
+ }
+
+ geo->setName(city);
+ geo->setProvince(province);
+ geo->setCountry(country);
+ geo->setLat(lat);
+ geo->setLong(lng);
+ geo->setTZ(TZ);
+ geo->setTZRule(& KStarsData::Instance()->Rulebook[ TZRule ]);
+
+ //If we are changing current location update it
+ if(m_currentLocation == fullName) {
+ setLocation(geo->fullName());
+ }
+
+ mycitydb.commit();
+ mycitydb.close();
+ return true;
+ }
+ return false;
+}
+
+QString LocationDialogLite::getCity(QString fullName) {
+ GeoLocation *geo = filteredCityList.value(fullName);
+ if(geo) {
+ return geo->name();
+ }
+ return "";
+}
+
+QString LocationDialogLite::getProvince(QString fullName) {
+ GeoLocation *geo = filteredCityList.value(fullName);
+ if(geo) {
+ return geo->province();
+ }
+ return "";
+}
+
+QString LocationDialogLite::getCountry(QString fullName) {
+ GeoLocation *geo = filteredCityList.value(fullName);
+ if(geo) {
+ return geo->country();
+ }
+ return "";
+}
+
+double LocationDialogLite::getLatitude(QString fullName) {
+ GeoLocation *geo = filteredCityList.value(fullName);
+ if(geo) {
+ return geo->lat()->Degrees();
+ }
+ return 0;
+}
+
+double LocationDialogLite::getLongitude(QString fullName) {
+ GeoLocation *geo = filteredCityList.value(fullName);
+ if(geo) {
+ return geo->lng()->Degrees();
+ }
+ return 0;
+}
+
+int LocationDialogLite::getTZ(QString fullName) {
+ GeoLocation *geo = filteredCityList.value(fullName);
+ if(geo) {
+ return m_TZList.indexOf(QString::number(geo->TZ0()));
+ }
+ return -1;
+}
+
+int LocationDialogLite::getDST(QString fullName) {
+ GeoLocation *geo = filteredCityList.value(fullName);
+ QMap<QString, TimeZoneRule>& Rulebook = KStarsData::Instance()->Rulebook;
+ if(geo) {
+ foreach( const QString& key, Rulebook.keys() ) {
+ if( !key.isEmpty() && geo->tzrule()->equals(&Rulebook[key]) )
+ return m_DSTRules.indexOf(key);
+ }
+ }
+ return -1;
+}
+
+bool LocationDialogLite::isDuplicate(QString city, QString province, QString country) {
+ KStarsData *data = KStarsData::Instance();
+ foreach ( GeoLocation *loc, data->getGeoList() ) {
+ QString sc( loc->translatedName() );
+ QString ss( loc->translatedCountry() );
+ QString sp = "";
+ if ( !loc->province().isEmpty() )
+ sp = loc->translatedProvince();
+
+ if ( sc.toLower() == city.toLower() &&
+ sp.toLower() == province.toLower() &&
+ ss.toLower() == country.toLower() ) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool LocationDialogLite::isReadOnly(QString fullName) {
+ GeoLocation *geo = filteredCityList.value(fullName);
+ if(geo) {
+ return geo->isReadOnly();
+ } else {
+ return true; //We return true if geolocation wasn't found
+ }
+}
+
+QSqlDatabase LocationDialogLite::getDB() {
+ QSqlDatabase mycitydb = QSqlDatabase::database("mycitydb");
+ QString dbfile = KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "mycitydb.sqlite";
+
+ // If it doesn't exist, create it
+ if (QFile::exists(dbfile) == false)
+ {
+ mycitydb.setDatabaseName(dbfile);
+ mycitydb.open();
+ QSqlQuery create_query(mycitydb);
+ QString query("CREATE TABLE city ( "
+ "id INTEGER DEFAULT NULL PRIMARY KEY AUTOINCREMENT, "
+ "Name TEXT DEFAULT NULL, "
+ "Province TEXT DEFAULT NULL, "
+ "Country TEXT DEFAULT NULL, "
+ "Latitude TEXT DEFAULT NULL, "
+ "Longitude TEXT DEFAULT NULL, "
+ "TZ REAL DEFAULT NULL, "
+ "TZRule TEXT DEFAULT NULL)");
+ if (create_query.exec(query) == false)
+ {
+ qWarning() << create_query.lastError() << endl;
+ return QSqlDatabase();
+ }
+ }
+ else if (mycitydb.open() == false)
+ {
+ qWarning() << mycitydb.lastError() << endl;
+ return QSqlDatabase();
+ }
+
+ return mycitydb;
+}
+
+bool LocationDialogLite::checkLongLat(QString longitude, QString latitude) {
+ if ( longitude.isEmpty() || latitude.isEmpty() )
+ return false;
+
+ bool ok;
+ double lng = createDms(longitude, true, &ok).Degrees();
+ if( !ok || std::isnan(lng))
+ return false;
+ double lat = createDms(latitude, true, &ok).Degrees();
+ if( !ok || std::isnan(lat))
+ return false;
+
+ if( fabs(lng) > 180 || fabs(lat) > 90 )
+ return false;
+
+ return true;
+}
+
+bool LocationDialogLite::setLocation(QString fullName) {
+ KStarsData *data = KStarsData::Instance();
+ GeoLocation *geo = filteredCityList.value(fullName);
+
+ if(!geo) {
+ foreach ( GeoLocation *loc, data->getGeoList() )
+ {
+ if( loc->fullName() == fullName) {
+ geo = loc;
+ break;
+ }
+ }
+ }
+
+ if(geo) {
+ data->setLocation(*geo);
+ data->setFullTimeUpdate();
+ KStarsLite::Instance()->updateTime();
+ return true;
+ }
+ return false;
+}
+
+dms LocationDialogLite::createDms (QString degree, bool deg, bool *ok )
+{
+ dms dmsAngle(0.0); // FIXME: Should we change this to NaN?
+ bool check;
+ check = dmsAngle.setFromString( degree, deg );
+ if (ok) *ok = check; //ok might be a null pointer!
+
+ return dmsAngle;
+}
+
+void LocationDialogLite::setCurrentLocation(QString loc) {
+ if(m_currentLocation != loc) {
+ m_currentLocation = loc;
+ emit currentLocationChanged(loc);
+ }
+}
+
+void LocationDialogLite::updateCurrentLocation() {
+ currentGeo = KStarsData::Instance()->geo();
+ setCurrentLocation(currentGeo->fullName());
+}
+
+
diff --git a/kstars/kstarslite/dialogs/locationdialoglite.h b/kstars/kstarslite/dialogs/locationdialoglite.h
new file mode 100644
index 0000000..a718e19
--- /dev/null
+++ b/kstars/kstarslite/dialogs/locationdialoglite.h
@@ -0,0 +1,109 @@
+/***************************************************************************
+ locationialoglite.h - K Desktop Planetarium
+ -------------------
+ begin : Sun Aug 21 2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * This program 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef LOCATIONDIALOGLITE_H_
+#define LOCATIONDIALOGLITE_H_
+
+#include <QStringListModel>
+#include <QSqlDatabase>
+
+#include "skyobjects/skyobject.h"
+
+/** @class LocationDialogLite
+ * A backend of location dialog declared in QML.
+ *
+ * @short Backend for location dialog in QML
+ * @author Artem Fedoskin, Jason Harris
+ * @version 1.0
+ */
+
+class GeoLocation;
+
+class LocationDialogLite : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString currentLocation READ getCurrentLocation WRITE setCurrentLocation NOTIFY currentLocationChanged)
+ Q_PROPERTY(QStringList TZList MEMBER m_TZList NOTIFY TZListChanged)
+ Q_PROPERTY(QStringList DSTRules MEMBER m_DSTRules NOTIFY DSTRulesChanged)
+ Q_PROPERTY(int currLocIndex MEMBER m_currLocIndex NOTIFY currLocIndexChanged)
+public:
+ LocationDialogLite();
+ typedef enum { CITY_ADD, CITY_UPDATE, CITY_REMOVE } CityOperation;
+
+ Q_INVOKABLE void filterCity(QString city, QString province, QString country);
+
+ void setCurrentLocation(QString loc);
+ QString getCurrentLocation() { return m_currentLocation; }
+ Q_INVOKABLE bool editCity(QString fullName, QString city, QString province, QString country, QString latitude, QString longitude, QString TimeZoneString, QString TZRule);
+
+ Q_INVOKABLE bool setLocation(QString fullName);
+
+ Q_INVOKABLE bool addCity(QString city, QString province, QString country, QString latitude, QString longitude, QString TimeZoneString, QString TZRule);
+ Q_INVOKABLE bool deleteCity(QString fullName);
+
+ Q_INVOKABLE bool isReadOnly(QString fullName);
+
+ Q_INVOKABLE QString getCity(QString fullName);
+ Q_INVOKABLE QString getProvince(QString fullName);
+ Q_INVOKABLE QString getCountry(QString fullName);
+ Q_INVOKABLE double getLatitude(QString fullName);
+ Q_INVOKABLE double getLongitude(QString fullName);
+ Q_INVOKABLE int getTZ(QString fullName);
+ Q_INVOKABLE int getDST(QString fullName);
+ Q_INVOKABLE bool isDuplicate(QString city, QString province, QString country);
+
+ /**
+ * @brief checkLongLat checks whether given longitude and latitude are valid
+ */
+ Q_INVOKABLE bool checkLongLat(QString longitude, QString latitude);
+
+ /**
+ * TODO - port dmsBox to QML
+ * @brief createDms creates dms from string
+ * @param degree string that should be converted to degree
+ * @param deg if true, the value is in degrees. Otherwise, it is in hours.
+ * @param ok
+ * @return angle in dms
+ */
+ dms createDms ( QString degree, bool deg, bool *ok );
+
+public slots:
+ void initCityList();
+ void updateCurrentLocation();
+signals:
+ void currentLocationChanged(QString);
+ void TZListChanged(QStringList);
+ void DSTRulesChanged(QStringList);
+ void currLocIndexChanged(int);
+
+private:
+ /**
+ * @short checks whether database with cities is already created. Creates a new otherwise
+ * @return city database
+ */
+ QSqlDatabase getDB();
+
+ QStringListModel m_cityList;
+ QHash<QString, GeoLocation *> filteredCityList;
+ GeoLocation *SelectedCity;
+ GeoLocation *currentGeo;
+ QString m_currentLocation;
+ int m_currLocIndex;
+
+ QStringList m_TZList;
+ QStringList m_DSTRules;
+};
+
+#endif
diff --git a/kstars/kstarslite/dialogs/skyobjectlistmodel.cpp b/kstars/kstarslite/dialogs/skyobjectlistmodel.cpp
index 7873ee9..61463c0 100644
--- a/kstars/kstarslite/dialogs/skyobjectlistmodel.cpp
+++ b/kstars/kstarslite/dialogs/skyobjectlistmodel.cpp
@@ -42,8 +42,6 @@ QVariant SkyObjectListModel::data(const QModelIndex &index, int role) const {
return QVariant();
}
-
-
void SkyObjectListModel::setSkyObjectsList(QVector<QPair<QString, const SkyObject *>> sObjects) {
emit beginResetModel();
skyObjects = sObjects;
diff --git a/kstars/kstarslite/dialogs/skyobjectlistmodel.h b/kstars/kstarslite/dialogs/skyobjectlistmodel.h
index 4dfde2f..6c0d314 100644
--- a/kstars/kstarslite/dialogs/skyobjectlistmodel.h
+++ b/kstars/kstarslite/dialogs/skyobjectlistmodel.h
@@ -22,10 +22,11 @@
class SkyObject;
-/** @class FindDialogLite
- * A backend of dialog decleared in QML.
+/** @class SkyObjectListModel
+ * A model used in Find Object Dialog in QML. Each entry is a QString (name of object) and pointer to
+ * SkyObject itself
*
- * @short Backend for Find Object Dialog in QML
+ * @short Model that is used in Find Object Dialog
* @author Artem Fedoskin, Jason Harris
* @version 1.0
*/
@@ -44,11 +45,6 @@ public:
virtual QHash<int, QByteArray> roleNames() const;
- /*virtual bool removeRows(int row, int count, const QModelIndex &parent) {
- qDebug() << "TEST";
- return false;
- }*/
-
void setSkyObjectsList(QVector<QPair<QString, const SkyObject *>> sObjects);
private:
diff --git a/kstars/kstarslite/qml/CMakeLists.txt b/kstars/kstarslite/qml/CMakeLists.txt
index 37959f6..ae74205 100644
--- a/kstars/kstarslite/qml/CMakeLists.txt
+++ b/kstars/kstarslite/qml/CMakeLists.txt
@@ -13,18 +13,27 @@ install( FILES modules/BottomMenu.qml
modules/KSTab.qml
modules/KSListView.qml
modules/SkyMapLiteWrapper.qml
- modules/ObjectDetails.qml
modules/TimePage.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules )
install( FILES dialogs/FindDialog.qml
+ dialogs/LocationDialog.qml
+ dialogs/DetailsDialog.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/dialogs )
-
+
+install( FILES dialogs/helpers/DetailsAddLink.qml
+ dialogs/helpers/LocationEdit.qml
+ dialogs/helpers/DetailsItem.qml
+ dialogs/helpers/LocationLoading.qml
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/dialogs/helpers )
+
+install( FILES dialogs/menus/DetailsLinkMenu.qml
+ dialogs/menus/LocationsGeoMenu.qml
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/dialogs/menus )
+
install( FILES modules/popups/ColorSchemePopup.qml
modules/popups/ProjectionsPopup.qml
modules/popups/FOVPopup.qml
- modules/popups/AddLinkPopup.qml
- modules/popups/LinkMenu.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules/popups)
install ( FILES modules/menus/ContextMenu.qml
@@ -35,7 +44,6 @@ install( FILES modules/helpers/TopMenuButton.qml
modules/helpers/TimeSpinBox.qml
modules/helpers/PassiveNotification.qml
modules/helpers/Units.qml
- modules/helpers/DetailsItem.qml
modules/helpers/KSMenuItem.qml
modules/helpers/TelescopeControl.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules/helpers )
diff --git a/kstars/kstarslite/qml/modules/ObjectDetails.qml b/kstars/kstarslite/qml/dialogs/DetailsDialog.qml
index 66d0beb..6d0c544 100644
--- a/kstars/kstarslite/qml/modules/ObjectDetails.qml
+++ b/kstars/kstarslite/qml/dialogs/DetailsDialog.qml
@@ -3,8 +3,9 @@ import QtQuick.Window 2.2
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import "helpers"
+import "menus"
+import "../modules"
import "../constants" 1.0
-import "popups"
KSPage {
title: SkyMapLite.clickedObjectLite.translatedName + " - " + tabBar.currentItem.text
@@ -307,13 +308,6 @@ KSPage {
clip: true
id: links
- /*Flickable {
- anchors.fill: parent
- ScrollBar.vertical: ScrollBar { }
- flickableDirection: Flickable.VerticalFlick
-
- contentHeight: linkCol.height*/
-
GridLayout {
id: linkCol
rowSpacing: 15
@@ -357,7 +351,7 @@ KSPage {
model: DetailDialogLite.infoTitleList
onClicked: {
- linkMenu.openForInfo(index)
+ detailsLinkMenu.openForInfo(index)
}
}
}
@@ -393,7 +387,7 @@ KSPage {
model: DetailDialogLite.imageTitleList
onClicked: {
- linkMenu.openForImage(index)
+ detailsLinkMenu.openForImage(index)
}
}
}
@@ -407,7 +401,7 @@ KSPage {
anchors.bottom: parent.bottom
onClicked: {
- addLinkPopup.openAdd()
+ detailsAddLink.openAdd()
}
}
}
diff --git a/kstars/kstarslite/qml/dialogs/FindDialog.qml b/kstars/kstarslite/qml/dialogs/FindDialog.qml
index fee39f5..fdd96ad 100644
--- a/kstars/kstarslite/qml/dialogs/FindDialog.qml
+++ b/kstars/kstarslite/qml/dialogs/FindDialog.qml
@@ -9,7 +9,7 @@ import "../modules"
KSPage {
contentItem: findColumn
- title: "Find an Object"
+ title: xi18n("Find an Object")
onVisibleChanged: {
if(visible) {
typeChoose.currentIndex = 0
diff --git a/kstars/kstarslite/qml/dialogs/LocationDialog.qml b/kstars/kstarslite/qml/dialogs/LocationDialog.qml
new file mode 100644
index 0000000..ce97e1b
--- /dev/null
+++ b/kstars/kstarslite/qml/dialogs/LocationDialog.qml
@@ -0,0 +1,131 @@
+import QtQuick 2.6
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Universal 2.0
+import "../constants" 1.0
+import "../modules"
+
+KSPage {
+ contentItem: locationColumn
+ title: xi18n("Set Geolocation")
+
+ function filterCities() {
+ LocationDialogLite.filterCity(cityFilter.text, provinceFilter.text, countryFilter.text)
+ }
+
+ onVisibleChanged: {
+ filterCities()
+ }
+
+ ColumnLayout {
+ id: locationColumn
+ spacing: 5 * num.dp
+ anchors{
+ bottom: parent.bottom
+ bottomMargin: 15 * num.dp
+ }
+
+ Flow {
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ Label {
+ text: xi18n("Current Location: ")
+ }
+
+ Label {
+ text: LocationDialogLite.currentLocation
+ }
+ }
+
+ Rectangle {
+ Layout.fillWidth: true
+ height: 1
+ color: "grey"
+ }
+
+ GridLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ flow: window.isPortrait ? GridLayout.TopToBottom : GridLayout.LeftToRight
+
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Label {
+ text: xi18n("City filter: ")
+ }
+ TextField {
+ id: cityFilter
+ Layout.fillWidth: true
+ onTextChanged: {
+ filterCities()
+ }
+ }
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Label {
+ text: xi18n("Province filter: ")
+ }
+
+ TextField {
+ id: provinceFilter
+ Layout.fillWidth: true
+ onTextChanged: {
+ filterCities()
+ }
+ }
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Label {
+ text: xi18n("Country filter: ")
+ }
+ TextField {
+ id: countryFilter
+ Layout.fillWidth: true
+ onTextChanged: {
+ filterCities()
+ }
+ }
+ }
+ }
+
+ KSListView {
+ model: CitiesModel
+ textRole: "display"
+
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ checkCurrent: true
+ currentIndex: LocationDialogLite.currLocIndex
+ onClickCheck: false
+
+ onClicked: {
+ locationsGeoMenu.openMenu(text)
+ }
+ }
+
+ Button {
+ anchors {
+ bottom: parent.bottom
+ }
+
+ text: "Add Location"
+ onClicked: {
+ locationEdit.openAdd()
+ }
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/modules/popups/AddLinkPopup.qml b/kstars/kstarslite/qml/dialogs/helpers/DetailsAddLink.qml
index e593360..415ea87 100644
--- a/kstars/kstarslite/qml/modules/popups/AddLinkPopup.qml
+++ b/kstars/kstarslite/qml/dialogs/helpers/DetailsAddLink.qml
@@ -2,11 +2,10 @@ import QtQuick.Controls 2.0
import QtQuick 2.7
import QtQuick.Layouts 1.1
import "../../constants" 1.0
-import "../helpers"
-import ".." //Import modules
+import "../../modules" //Import modules
KSPage {
- id: linkPopup
+ id: addLink
title: SkyMapLite.clickedObjectLite.getTranslatedName() + " - " + (editMode ? xi18n("Edit Link") : xi18n("Add a Link") )
property bool editMode: false // true if popup is in edit mode. False if in add mode
property bool isImage: false //is the object for which this popup was opened an image or information
@@ -35,9 +34,9 @@ KSPage {
}
/**
- closes the popup and clears all text fields
+ closes the page and clears all text fields
*/
- function closePopup() {
+ function closeAddLink() {
descField.clear()
urlField.clear()
stackView.pop()
@@ -95,14 +94,14 @@ KSPage {
} else {
DetailDialogLite.addLink(urlField.text, descField.text, radioImg.checked)
}
- closePopup()
+ closeAddLink()
}
}
Button {
text: xi18n("Cancel")
onClicked: {
- closePopup()
+ closeAddLink()
}
}
}
diff --git a/kstars/kstarslite/qml/modules/helpers/DetailsItem.qml b/kstars/kstarslite/qml/dialogs/helpers/DetailsItem.qml
index 78a0f4c..78a0f4c 100644
--- a/kstars/kstarslite/qml/modules/helpers/DetailsItem.qml
+++ b/kstars/kstarslite/qml/dialogs/helpers/DetailsItem.qml
diff --git a/kstars/kstarslite/qml/dialogs/helpers/LocationEdit.qml b/kstars/kstarslite/qml/dialogs/helpers/LocationEdit.qml
new file mode 100644
index 0000000..409d6b2
--- /dev/null
+++ b/kstars/kstarslite/qml/dialogs/helpers/LocationEdit.qml
@@ -0,0 +1,330 @@
+import QtQuick.Controls 2.0
+import QtQuick 2.7
+import QtQuick.Layouts 1.1
+import "../../constants" 1.0
+import "../../modules"
+import QtPositioning 5.2
+
+KSPage {
+ id: locationEdit
+ title: editMode ? xi18n("Edit location") : (isReadOnly ? xi18n("View location") : xi18n("Add location"))
+ property bool editMode: false
+ property bool isAvailable: positionSource.valid
+ property bool isReadOnly: false
+ property string geoName
+ property bool fieldsChanged: false //true whenever either city, province or country fields are changed. Turned to false every time this page is opened
+
+ function openAdd() {
+ editMode = false
+ isReadOnly = false
+ stackView.push(this)
+ fieldsChanged = false
+ }
+
+ function openEdit(fullName, readOnly) {
+ geoName = fullName
+ isReadOnly = readOnly
+
+ if(!readOnly) {
+ editMode = true
+ }
+
+ cityField.text = LocationDialogLite.getCity(fullName)
+ provinceField.text = LocationDialogLite.getProvince(fullName)
+ countryField.text = LocationDialogLite.getCountry(fullName)
+
+ latField.text = LocationDialogLite.getLatitude(fullName)
+ longField.text = LocationDialogLite.getLongitude(fullName)
+
+ comboBoxTZ.currentIndex = LocationDialogLite.getTZ(fullName)
+ comboBoxDST.currentIndex = LocationDialogLite.getDST(fullName)
+ stackView.push(this)
+ fieldsChanged = false
+ }
+
+ PositionSource {
+ id: positionSource
+
+ onSourceErrorChanged: {
+ if (sourceError == PositionSource.NoError)
+ return
+
+ var errorDesc = ""
+
+ if (sourceError == 2 || sourceError == 1) {
+ errorDesc = xi18n("No location service (GPS, Wi-Fi etc.) is available. Please, switch on location service and retry")
+ } else if (sourceError == 4) {
+ errorDesc = xi18n("Unknown error occured. Please contact application developer.")
+ }
+
+ notification.showNotification("Location error: " + errorDesc)
+ active = false
+ sourceError = positionSource.NoError
+ }
+
+ onUpdateTimeout: {
+ notification.showNotification(xi18n("Timeout occured. Try again."))
+ }
+
+ onActiveChanged: {
+ if(positionSource.active) {
+ locationLoading.open()
+ } else {
+ locationLoading.close()
+ }
+ }
+
+ onPositionChanged: {
+ if( (!positionSource.position.latitudeValid ||
+ !positionSource.position.longitudeValid) ) {
+ latField.text = ""
+ longField.text = ""
+ if(isLoaded) {
+ notification.showNotification(xi18n("Couldn't get latitude and longitude from GPS"))
+ }
+ } else {
+ var lat = positionSource.position.coordinate.latitude
+ var longitude = positionSource.position.coordinate.longitude
+ latField.text = lat
+ longField.text = longitude
+ notification.showNotification(xi18("Found your longitude and altitude"))
+ }
+
+ locationLoading.close()
+ }
+
+ preferredPositioningMethods: PositionSource.AllPositioningMethods
+ }
+
+ /**
+ closes the popup and clears all text fields
+ */
+
+ onVisibleChanged: {
+ if(!visible) {
+ cityField.clear()
+ provinceField.clear()
+ countryField.clear()
+ latField.clear()
+ longField.clear()
+ }
+ }
+
+ ColumnLayout {
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ GridLayout {
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ flow: window.isPortrait ? GridLayout.TopToBottom : GridLayout.LeftToRight
+
+ ColumnLayout {
+ anchors.top: parent.top
+ Layout.maximumWidth: window.isPortrait ? parent.width : parent.width/2
+
+ RowLayout {
+ Label {
+ text: xi18n("City: ")
+ }
+
+ TextField {
+ id: cityField
+ Layout.fillWidth: true
+ onTextChanged: fieldsChanged = true
+ readOnly: isReadOnly
+ }
+ }
+
+ RowLayout {
+ Label {
+ text: xi18n("Province: ")
+ }
+
+ TextField {
+ id: provinceField
+ Layout.fillWidth: true
+ onTextChanged: fieldsChanged = true
+ readOnly: isReadOnly
+ }
+ }
+
+ RowLayout {
+ Label {
+ text: xi18n("Country: ")
+ }
+
+ TextField {
+ id: countryField
+ Layout.fillWidth: true
+ onTextChanged: fieldsChanged = true
+ readOnly: isReadOnly
+ }
+ }
+ }
+
+ Item {
+ height: window.isPortrait ? 15 : 0
+ }
+
+ ColumnLayout {
+ Layout.maximumWidth: window.isPortrait ? parent.width : parent.width/2
+
+ RowLayout {
+ Label {
+ text: xi18n("Latitude: ")
+ }
+
+ TextField {
+ id: latField
+ Layout.fillWidth: true
+ readOnly: isReadOnly
+ }
+ }
+
+ RowLayout {
+
+ Label {
+ text: xi18n("Longitude: ")
+ }
+
+ TextField {
+ id: longField
+ Layout.fillWidth: true
+ readOnly: isReadOnly
+ }
+ }
+
+ Flow {
+ Layout.fillWidth: true
+ spacing: 10
+
+ RowLayout {
+ Label {
+ text: xi18n("UT offset: ")
+ }
+
+ ComboBox {
+ id: comboBoxTZ
+ model: LocationDialogLite.TZList
+ }
+ }
+
+ RowLayout {
+ Label {
+ text: xi18n("DST Rule: ")
+ }
+
+ ComboBox {
+ id: comboBoxDST
+ model: LocationDialogLite.DSTRules
+ }
+ }
+ }
+ }
+ }
+
+ Flow {
+ Layout.fillWidth: true
+ spacing: 10
+
+ Button {
+ visible: !isReadOnly
+ text: "Set from GPS"
+ enabled: isAvailable
+ onClicked: {
+ positionSource.update()
+ if(!positionSource.valid) {
+ positionSource.stop()
+ notification.showNotification(xi18("Positioning is not available on your device"))
+ }
+ }
+
+ Connections {
+ target: locationLoading
+ onClosed: {
+ positionSource.stop()
+ }
+ }
+ }
+
+ Button {
+ //enabled:
+ visible: !isReadOnly
+ text: editMode ? xi18n("Save") : xi18n("Add")
+ onClicked: {
+ if(cityField.text == "") {
+ notification.showNotification(xi18n("Please, fill in city"))
+ return
+ } else if(countryField.text == "") {
+ notification.showNotification(xi18n("Please, fill in country"))
+ return
+ } else if(latField.text == "") {
+ notification.showNotification(xi18n("Please, fill in latitude"))
+ return
+ } else if(longField.text == "") {
+ notification.showNotification(xi18n("Please, fill in longitude"))
+ return
+ }
+
+ if(!LocationDialogLite.checkLongLat(longField.text, latField.text)) {
+ notification.showNotification(xi18n("Either longitude or latitude values are not valid"))
+ return
+ }
+
+ if(fieldsChanged) {
+ if(LocationDialogLite.isDuplicate(cityField.text, provinceField.text, countryField.text)) {
+ notification.showNotification(xi18n("This location already exists. Change either city, province or country"))
+ return
+ }
+ }
+
+ //Fullname of new location
+ var fullName = cityField.text + ", "
+ if(provinceField.text != "") {
+ fullName += provinceField.text + ", "
+ }
+ fullName += countryField.text
+
+ if(!editMode) {
+ if(!LocationDialogLite.addCity(cityField.text, provinceField.text, countryField.text,
+ latField.text, longField.text, comboBoxTZ.currentText,
+ comboBoxDST.currentText)) {
+ notification.showNotification(xi18n("Failed to add location"))
+ return
+ } else {
+ notification.showNotification(xi18n("Added new location - " + fullName))
+ }
+ } else {
+ if(!LocationDialogLite.editCity(geoName, cityField.text, provinceField.text, countryField.text,
+ latField.text, longField.text, comboBoxTZ.currentText,
+ comboBoxDST.currentText)) {
+ notification.showNotification(xi18n("Failed to edit city"))
+ return
+ }
+ }
+
+ locationDialog.filterCities()
+ if(!editMode) {
+ //If we are adding location then open menu with newly added location
+ locationsGeoMenu.openMenu(fullName)
+ }
+
+ stackView.pop()
+ }
+ }
+
+ Button {
+ text: xi18n("Cancel")
+ onClicked: {
+ stackView.pop()
+ }
+ }
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/dialogs/helpers/LocationLoading.qml b/kstars/kstarslite/qml/dialogs/helpers/LocationLoading.qml
new file mode 100644
index 0000000..fe00b62
--- /dev/null
+++ b/kstars/kstarslite/qml/dialogs/helpers/LocationLoading.qml
@@ -0,0 +1,45 @@
+import QtQuick.Controls 2.0
+import QtQuick 2.7
+import QtQuick.Layouts 1.1
+import "../../constants" 1.0
+import "../../modules"
+import QtPositioning 5.2
+
+Popup {
+ x: (window.width - width) / 2
+ y: window.height / 6
+ focus: true
+ modal: true
+
+ Pane {
+ id: aboutDialog
+ focus: true
+ width: Math.min(window.width, window.height) / 3 * 2
+
+ Column {
+ id: loadingColumn
+ width: parent.width
+
+ BusyIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ running: image.status === Image.Loading
+ }
+
+ Label {
+ id: fetchText
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Label.AlignHCenter
+ text: xi18n("Please, wait while we are fetching coordinates")
+ }
+
+ Button {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: xi18n("Cancel")
+ onClicked: {
+ close()
+ }
+ }
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/modules/popups/LinkMenu.qml b/kstars/kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml
index 83ccf30..75dcc34 100644
--- a/kstars/kstarslite/qml/modules/popups/LinkMenu.qml
+++ b/kstars/kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml
@@ -2,7 +2,8 @@ import QtQuick.Controls 2.0
import QtQuick 2.7
import QtQuick.Layouts 1.1
import "../../constants" 1.0
-import "../helpers"
+import "../../modules/"
+import "../../modules/helpers"
Menu {
modal: true
@@ -37,7 +38,7 @@ Menu {
KSMenuItem {
text: xi18n("Edit")
onTriggered: {
- addLinkPopup.openEdit(itemIndex, isImage)
+ detailsAddLink.openEdit(itemIndex, isImage)
}
}
diff --git a/kstars/kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml b/kstars/kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml
new file mode 100644
index 0000000..7d6e7b9
--- /dev/null
+++ b/kstars/kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml
@@ -0,0 +1,82 @@
+import QtQuick.Controls 2.0
+import QtQuick 2.7
+import QtQuick.Layouts 1.1
+import "../../constants" 1.0
+import "../../modules/"
+import "../../modules/helpers"
+
+Menu {
+ id: locationsMenu
+ modal: true
+ transformOrigin: Menu.Center
+ padding: 0
+ property string locName
+ property bool isReadOnly
+
+ function openMenu(name) {
+ locName = name
+ isReadOnly = LocationDialogLite.isReadOnly(name)
+ console.log(name + " " + isReadOnly)
+
+ open()
+ }
+
+ Column {
+ width: parent.width
+ spacing: 10
+
+ Label {
+ id: name
+ text: locName
+ wrapMode: Label.WrapAtWordBoundaryOrAnywhere
+ width: parent.width
+ font.pointSize: 12
+ anchors {
+ left: parent.left
+ leftMargin: 10
+ }
+ }
+
+ Rectangle {
+ color: "grey"
+ width: parent.width - 10
+ height: 1
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+
+ KSMenuItem {
+ text: xi18n("Set as my location")
+ onTriggered: {
+ if(LocationDialogLite.setLocation(locName)) {
+ notification.showNotification(xi18n("Set " + locName + " as current location"))
+ } else {
+ notification.showNotification(xi18n("Couldn't set " + locName + " as current location"))
+ }
+ locationDialog.filterCities()
+ }
+ }
+
+ KSMenuItem {
+ text: isReadOnly ? xi18n("View") : xi18n("Edit")
+ onTriggered: {
+ if(isReadOnly) {
+ locationEdit.openEdit(locName, true)
+ } else {
+ locationEdit.openEdit(locName, false)
+ }
+ }
+ }
+
+ KSMenuItem {
+ enabled: !isReadOnly
+ text: xi18n("Delete")
+ onTriggered: {
+ LocationDialogLite.deleteCity(locName)
+ notification.showNotification(xi18n("Deleted location " + locName))
+ locationDialog.filterCities()
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/main.qml b/kstars/kstarslite/qml/main.qml
index 37f4623..8651cf9 100644
--- a/kstars/kstarslite/qml/main.qml
+++ b/kstars/kstarslite/qml/main.qml
@@ -13,6 +13,9 @@ import "modules/popups"
import "modules/menus"
import "dialogs"
+import "dialogs/menus"
+import "dialogs/helpers"
+
import "constants" 1.0
import "indi"
@@ -36,7 +39,7 @@ ApplicationWindow {
header: ToolBar {
id: toolBar
Material.foreground: "white"
- height: stackView.currentItem != initPage ? backButton.height: 0
+ height: stackView.currentItem != initPage ? backButton.height : 0
visible: stackView.currentItem != initPage
Behavior on height {
@@ -46,10 +49,11 @@ ApplicationWindow {
}
}
- RowLayout {
+ Row {
+ id: toolRow
spacing: 20
- height: titleLabel.height
- Layout.fillWidth: true
+ height: parent.height
+ width: parent.width
ToolButton {
id: backButton
@@ -67,36 +71,15 @@ ApplicationWindow {
Label {
id: titleLabel
text: stackView.currentItem.title
+
font.pixelSize: 20
+ width: parent.width - backButton.width - toolRow.spacing //To allow ellision of the text
+
elide: Label.ElideRight
- //horizontalAlignment: Qt.AlignHCenter
- verticalAlignment: Qt.AlignVCenter
- Layout.fillWidth: true
- }
+ wrapMode: Label.Wrap
+ maximumLineCount: 1
- ToolButton {
- /*contentItem: Image {
- fillMode: Image.Pad
- horizontalAlignment: Image.AlignHCenter
- verticalAlignment: Image.AlignVCenter
- //source: "qrc:/images/menu.png"
- }*/
- onClicked: optionsMenu.open()
-
- Menu {
- id: optionsMenu
- x: parent.width - width
- transformOrigin: Menu.TopRight
-
- MenuItem {
- text: "Settings"
- onTriggered: settingsPopup.open()
- }
- MenuItem {
- text: "About"
- onTriggered: aboutDialog.open()
- }
- }
+ anchors.verticalCenter: parent.verticalCenter
}
}
}
@@ -125,17 +108,44 @@ ApplicationWindow {
id: units
}
- //Pages
+ //Dialogs
FindDialog {
id: findDialog
}
- INDIControlPanel {
- id: indiControlPanel
+ //Details
+ DetailsDialog {
+ id: detailsDialog
}
- ObjectDetails {
- id: objectDetails
+ DetailsAddLink {
+ id: detailsAddLink
+ x: (window.width - width)/2
+ y: (window.height - height)/2
+ }
+
+ DetailsLinkMenu {
+ id: detailsLinkMenu
+ x: (window.width - width)/2
+ y: (window.height - height)/2
+ }
+
+ //Location
+ LocationDialog {
+ id: locationDialog
+ }
+
+ LocationEdit {
+ id: locationEdit
+ }
+
+ LocationLoading {
+ id: locationLoading
+ }
+
+ //Pages
+ INDIControlPanel {
+ id: indiControlPanel
}
Page {
@@ -185,18 +195,12 @@ ApplicationWindow {
y: (window.height - height)/2
}
- //Links
- AddLinkPopup {
- id: addLinkPopup
+ LocationsGeoMenu {
+ id: locationsGeoMenu
x: (window.width - width)/2
y: (window.height - height)/2
}
- LinkMenu {
- id: linkMenu
- x: (window.width - width)/2
- y: (window.height - height)/2
- }
Drawer {
id: globalDrawer
@@ -244,17 +248,13 @@ ApplicationWindow {
width: parent.width
text: model.objID.title
onClicked: {
- if (pagesList.currentIndex != index) {
- pagesList.currentIndex = index
-
- if(stackView.currentItem != model.objID) {
- if(model.objID != initPage) {
- //skyMapLiteWrapper.visible = false
- stackView.replace(null, [initPage, model.objID])
- } else {
- stackView.replace(null, initPage)
- //skyMapLiteWrapper.visible = true
- }
+ if(stackView.currentItem != model.objID) {
+ if(model.objID != initPage) {
+ //skyMapLiteWrapper.visible = false
+ stackView.replace(null, [initPage, model.objID])
+ } else {
+ stackView.replace(null, initPage)
+ //skyMapLiteWrapper.visible = true
}
globalDrawer.close()
}
@@ -267,6 +267,7 @@ ApplicationWindow {
append({objID: initPage});
append({objID: indiControlPanel});
append({objID: findDialog});
+ append({objID: locationDialog});
}
}
@@ -281,14 +282,13 @@ ApplicationWindow {
width: Math.min(window.width, window.height) / 4 * 2
height: window.height
//Disable drawer while loading and if SkyMapLite is not visible
- dragMargin: isSkyMapVisible && isLoaded ? Qt.styleHints.startDragDistance : -Qt.styleHints.startDragDistance
+ dragMargin: isSkyMapVisible && isLoaded ? Qt.styleHints.startDragDistance + 15 : -Qt.styleHints.startDragDistance
+ edge: Qt.RightEdge
onOpened: {
globalDrawer.close()
}
- edge: Qt.RightEdge
-
Label {
id: contextTitle
anchors {
diff --git a/kstars/kstarslite/qml/modules/KSListView.qml b/kstars/kstarslite/qml/modules/KSListView.qml
index 911c191..73e0748 100644
--- a/kstars/kstarslite/qml/modules/KSListView.qml
+++ b/kstars/kstarslite/qml/modules/KSListView.qml
@@ -8,6 +8,8 @@ ListView {
clip: true
property bool checkCurrent: false
property bool checkable: false
+ property bool onClickCheck: true //true if the item should be be mapped with a blue rectangle when clicked
+
property int maxWidth: 0
property bool modelIsChanged: false
implicitWidth: maxWidth
@@ -17,6 +19,7 @@ ListView {
onCountChanged: {
for(var child in listView.contentItem.children) {
var childWidth = listView.contentItem.children[child].textWidth
+ if(childWidth == undefined) childWidth = 0
maxWidth = maxWidth > childWidth ? maxWidth : childWidth
}
}
@@ -24,7 +27,7 @@ ListView {
ScrollIndicator.vertical: ScrollIndicator { }
property string textRole: ""
- signal clicked(var index, var checked)
+ signal clicked(var text, var index, var checked)
property bool modelIsArray: false
onModelChanged: {
@@ -37,6 +40,7 @@ ListView {
height: objName.contentHeight + 30
property int textWidth: objRow.width + objRow.anchors.leftMargin*2
property bool checked: false
+ property string visibleText: objName.text
border {
color: "#becad5"
@@ -109,14 +113,15 @@ ListView {
}
onClicked: {
- listView.currentIndex = model.index
+ if(onClickCheck) listView.currentIndex = model.index
if(checkable) delegateRect.checked = !delegateRect.checked
- listView.clicked(model.index, delegateRect.checked)
+ listView.clicked(objName.text, model.index, delegateRect.checked)
}
}
RowLayout {
id: objRow
+
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
@@ -127,7 +132,7 @@ ListView {
visible: (checkCurrent && listView.currentIndex == model.index) || (checkable && delegateRect.checked)
color: "#2173f3"
width: height
- height: objName.height/2
+ height: objName.font.pixelSize/2
radius: width * 0.5
}
@@ -135,12 +140,12 @@ ListView {
id: objName
text: textRole == "" ? modelData : listView.modelIsArray ? modelData[textRole] : model[textRole]
+ wrapMode: Text.WrapAnywhere
Behavior on color {
ColorAnimation { duration: 200 }
}
}
-
}
}
}
diff --git a/kstars/kstarslite/qml/modules/helpers/PassiveNotification.qml b/kstars/kstarslite/qml/modules/helpers/PassiveNotification.qml
index ca61cdd..7377f7b 100644
--- a/kstars/kstarslite/qml/modules/helpers/PassiveNotification.qml
+++ b/kstars/kstarslite/qml/modules/helpers/PassiveNotification.qml
@@ -36,6 +36,7 @@ MouseArea {
bottom: parent.bottom
bottomMargin: units.gridUnit * 4
}
+
function showNotification(message, timeout, actionText, callBack) {
if (!message) {
return;
@@ -107,6 +108,7 @@ MouseArea {
id: background
width: backgroundRect.width + units.gridUnit
height: backgroundRect.height + units.gridUnit
+
Rectangle {
id: backgroundRect
anchors.centerIn: parent
@@ -116,13 +118,16 @@ MouseArea {
width: mainLayout.width + Math.round((height - mainLayout.height))
height: Math.max(mainLayout.height + units.smallSpacing*2, units.gridUnit*2)
}
+
RowLayout {
id: mainLayout
anchors.centerIn: parent
Controls.Label {
id: messageLabel
width: Math.min(root.parent.width - units.largeSpacing*2, implicitWidth)
- elide: Text.ElideRight
+ anchors.centerIn: parent
+ wrapMode: Controls.Label.WrapAtWordBoundaryOrAnywhere
+
color: num.sysPalette.window
}
Controls.Button {
@@ -138,6 +143,7 @@ MouseArea {
}
}
}
+
layer.enabled: true
layer.effect: DropShadow {
horizontalOffset: 0
diff --git a/kstars/kstarslite/qml/modules/menus/ContextMenu.qml b/kstars/kstarslite/qml/modules/menus/ContextMenu.qml
index f841fad..1aabce9 100644
--- a/kstars/kstarslite/qml/modules/menus/ContextMenu.qml
+++ b/kstars/kstarslite/qml/modules/menus/ContextMenu.qml
@@ -26,10 +26,10 @@ Menu {
width: parent.width
spacing: 10
- Text {
+ Label {
id: objectName
text: isPoint ? xi18n("Empty Sky") : SkyMapLite.clickedObjectLite.translatedName
- wrapMode: Text.Wrap
+ wrapMode: Label.WrapAtWordBoundaryOrAnywhere
width: parent.width
font.pointSize: 12
anchors {
@@ -56,7 +56,7 @@ Menu {
KSMenuItem {
visible: !isPoint
text: xi18n("Details")
- onTriggered: stackView.push(objectDetails)
+ onTriggered: stackView.push(detailsDialog)
}
Item {
diff --git a/kstars/kstarsliteinit.cpp b/kstars/kstarsliteinit.cpp
index 8ed8826..e8f8d3b 100644
--- a/kstars/kstarsliteinit.cpp
+++ b/kstars/kstarsliteinit.cpp
@@ -43,7 +43,7 @@ void KStarsLite::datainitFinished() {
//DEBUG
qDebug() << "The current Date/Time is: " << KStarsDateTime::currentDateTime().toString();
- //Notify Splash in QML that loading of data is finished
+ //Notify Splash in QML and LocationDialogLite that loading of data is finished
dataLoadFinished();
map()->forceUpdate();
}
diff --git a/kstars/main.cpp b/kstars/main.cpp
index 299a23e..550f6cc 100644
--- a/kstars/main.cpp
+++ b/kstars/main.cpp
@@ -238,16 +238,6 @@ int main(int argc, char *argv[])
}
#endif
- //Under construction
- //[Location]
- Options::setCityName("Saarbr├╝cken");
- Options::setCountryName("Germany");
- Options::setDST("EU");
- Options::setLatitude(49.233333333333334);
- Options::setLongitude(7);
- Options::setTimeZone(1);
- Options::setRunClock(false);
-
// Create writable data dir if it does not exist
QDir writableDir;
writableDir.mkdir(KSPaths::writableLocation(QStandardPaths::GenericDataLocation));