Commit f302bb0c authored by Jasem Mutlaq's avatar Jasem Mutlaq

More porting work for KF5

parent 01886264
......@@ -37,29 +37,39 @@ find_package(KF5 REQUIRED COMPONENTS
KIO
WindowSystem
XmlGui
Plotting
TextEditor
)
find_package(Eigen3 REQUIRED)
add_definitions(${EIGEN_DEFINITIONS})
include_directories(${EIGEN3_INCLUDE_DIR})
#PyKDE4 Package TODO? Is there KF5 Package?
find_package(CFitsio)
SET(HAVE_CFITSIO CFITSIO_FOUND)
set_package_properties(CFitsio PROPERTIES DESCRIPTION "FITS IO Library" URL "http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html" TYPE OPTIONAL PURPOSE "Support for the FITS (Flexible Image Transport System) data format in KStars.")
find_package(INDI)
SET(INDI_FOUND HAVE_INDI_H)
SET(HAVE_INDI INDI_FOUND)
set_package_properties(INDI PROPERTIES DESCRIPTION "Astronomical instrumentation control" URL "http://www.indilib.org" TYPE OPTIONAL PURPOSE "Support for controlling astronomical devices on Linux with KStars.")
find_package(WCSLIB)
set(HAVE_WCSLIB WCSLIB_FOUND)
set_package_properties(WCSLIB PROPERTIES DESCRIPTION "World Coordinate System library" URL "http://www.atnf.csiro.au/people/mcalabre/WCS" TYPE OPTIONAL PURPOSE "WCS enables KStars to read and process world coordinate systems in FITS header.")
# FIXME QJSON is not needed in Qt5
find_package(QJSON)
find_package(Xplanet)
set(HAVE_XPLANET XPLANET_FOUND)
set_package_properties(Xplanet PROPERTIES DESCRIPTION "Renders an image of all the major planets and most satellites" URL "http://xplanet.sourceforge.net" TYPE OPTIONAL PURPOSE "Gives KStars support for xplanet.")
find_package(AstrometryNet)
set(HAVE_ASTROMETRYNET ASTROMETRYNET_FOUND)
set_package_properties(OpenGL PROPERTIES DESCRIPTION "Astrometrics Library" URL "http://www.astrometry.net" TYPE OPTIONAL PURPOSE "Support for plate solving in KStars.")
find_package(OpenGL)
set_package_properties(OpenGL PROPERTIES DESCRIPTION "Open Graphics Library" URL "http://www.opengl.org" TYPE OPTIONAL PURPOSE "Support for hardware rendering in KStars.")
......
/* Define if you have fitsio.h */
#cmakedefine HAVE_CFITSIO_H 1
#cmakedefine HAVE_CFITSIO 1
/* Define if you have indidevapi.h */
#cmakedefine HAVE_INDI_H 1
#cmakedefine HAVE_INDI 1
/* Define if you have xplanet */
#cmakedefine HAVE_XPLANET 1
......
......@@ -21,8 +21,7 @@
bool CatalogDB::Initialize() {
skydb_ = QSqlDatabase::addDatabase("QSQLITE", "skydb");
QString dbfile = KStandardDirs::locateLocal("appdata",
QString("skycomponents.db"));
QString dbfile = QStandardPaths::locate(QStandardPaths::DataLocation, QString("skycomponents.db"));
QFile testdb(dbfile);
bool first_run = false;
if (!testdb.exists()) {
......
......@@ -24,7 +24,7 @@
#include "kstars/skyobjects/starobject.h"
#include "kstars/skyobjects/deepskyobject.h"
#include "kstars/skycomponents/skycomponent.h"
#include <kstandarddirs.h>
#include <QStandardPaths>
#include <klocale.h>
#include <QDebug>
#include <KMessageBox>
......
......@@ -18,7 +18,7 @@
#ifndef KSTARS_KSPARSER_H
#define KSTARS_KSPARSER_H
#include "kstars/ksfilereader.h"
#include <kstandarddirs.h>
#include <QStandardPaths>
#include <QList>
#include <QFile>
#include <QHash>
......
......@@ -128,27 +128,28 @@ include_directories(
########### next target ###############
set(libkstarstools_SRCS
tools/altvstime.cpp
tools/astrocalc.cpp
tools/altvstime.cpp
tools/avtplotwidget.cpp
tools/calendarwidget.cpp
tools/conjunctions.cpp
tools/eqplotwidget.cpp
tools/conjunctions.cpp
tools/jmoontool.cpp
tools/ksconjunct.cpp
tools/modcalcangdist.cpp
tools/modcalcapcoord.cpp
tools/modcalcaltaz.cpp
tools/modcalcdaylength.cpp
tools/modcalceclipticcoords.cpp
tools/modcalcvizequinox.cpp
tools/modcalcgalcoord.cpp
tools/modcalcgeodcoord.cpp
tools/modcalcjd.cpp
tools/modcalcplanets.cpp
tools/modcalcsidtime.cpp
tools/modcalcvlsr.cpp
tools/observinglist.cpp
#FIXME needs porting
# tools/eqplotwidget.cpp
# tools/astrocalc.cpp
# tools/modcalcangdist.cpp
# tools/modcalcapcoord.cpp
# tools/modcalcaltaz.cpp
# tools/modcalcdaylength.cpp
# tools/modcalceclipticcoords.cpp
# tools/modcalcvizequinox.cpp
# tools/modcalcgalcoord.cpp
# tools/modcalcgeodcoord.cpp
# tools/modcalcjd.cpp
# tools/modcalcplanets.cpp
# tools/modcalcsidtime.cpp
# tools/modcalcvlsr.cpp
tools/observinglist.cpp
tools/sessionsortfilterproxymodel.cpp
tools/obslistwizard.cpp
tools/planetviewer.cpp
......@@ -209,18 +210,19 @@ qt5_wrap_ui(libkstarstools_SRCS
tools/argwaitforkey.ui
tools/argzoom.ui
tools/conjunctions.ui
tools/modcalcangdist.ui
tools/modcalcapcoord.ui
tools/modcalcaltaz.ui
tools/modcalcdaylength.ui
tools/modcalceclipticcoords.ui
tools/modcalcvizequinox.ui
tools/modcalcgalcoord.ui
tools/modcalcgeod.ui
tools/modcalcjd.ui
tools/modcalcplanets.ui
tools/modcalcsidtime.ui
tools/modcalcvlsr.ui
#FIXME needs porting
# tools/modcalcangdist.ui
# tools/modcalcapcoord.ui
# tools/modcalcaltaz.ui
# tools/modcalcdaylength.ui
# tools/modcalceclipticcoords.ui
# tools/modcalcvizequinox.ui
# tools/modcalcgalcoord.ui
# tools/modcalcgeod.ui
# tools/modcalcjd.ui
# tools/modcalcplanets.ui
# tools/modcalcsidtime.ui
# tools/modcalcvlsr.ui
tools/observinglist.ui
tools/obslistwizard.ui
tools/optionstreeview.ui
......@@ -291,14 +293,14 @@ set(libkstarswidgets_SRCS
widgets/timestepbox.cpp
widgets/timeunitbox.cpp
widgets/infoboxwidget.cpp
widgets/genericcalendarwidget.cpp
widgets/moonphasecalendarwidget.cpp
#widgets/genericcalendarwidget.cpp
# widgets/moonphasecalendarwidget.cpp
widgets/kshelplabel.cpp
)
qt5_wrap_ui(libkstarswidgets_SRCS
widgets/genericcalendarwidget.ui
)
#qt5_wrap_ui(libkstarswidgets_SRCS
# widgets/genericcalendarwidget.ui
#)
set( kstars_KCFG_SRCS Options.kcfgc )
......@@ -390,7 +392,7 @@ set(kstars_extra_SRCS
ksfilereader.cpp ksnumbers.cpp
kspopupmenu.cpp obslistpopupmenu.cpp ksalmanac.cpp
kstarsactions.cpp kstarsdata.cpp ksuserdb.cpp kstarsdatetime.cpp
kstarsdcop.cpp kstarsinit.cpp kstars.cpp
kstarsinit.cpp kstars.cpp
kstarssplash.cpp ksutils.cpp kswizard.cpp main.cpp
simclock.cpp skymap.cpp skymapdrawabstract.cpp skymapqdraw.cpp skymapevents.cpp
skypainter.cpp skyqpainter.cpp
......@@ -487,10 +489,13 @@ add_library( KStarsLib STATIC ${kstars_SRCS})
target_link_libraries(KStarsLib
LibKSDataHandlers
htmesh
KF5::I18n
KF5::NewStuff
KF5::KIO
KF5::KIOFileWidgets
KF5::WidgetsAddons
KF5::Plotting
KF5::TextEditor
Qt5::Gui
# ${KDE4_KDECORE_LIBS}
# ${QT_QTDECLARATIVE_LIBRARY}
......
......@@ -56,7 +56,7 @@ void BinFileHelper::clearFields() {
bool BinFileHelper::testFileExists( const QString &fileName ) {
QString FilePath = QStandardPaths::locate(QStandardPaths::DataLocation, fileName );
QByteArray b = FilePath.toAscii();
QByteArray b = FilePath.toLatin1();
const char *filepath = b.data();
FILE *f = KDE_fopen(filepath, "rb");
if( f ) {
......@@ -70,7 +70,7 @@ bool BinFileHelper::testFileExists( const QString &fileName ) {
FILE *BinFileHelper::openFile(const QString &fileName) {
QString FilePath = QStandardPaths::locate(QStandardPaths::DataLocation, fileName );
init();
QByteArray b = FilePath.toAscii();
QByteArray b = FilePath.toLatin1();
const char *filepath = b.data();
fileHandle = KDE_fopen(filepath, "rb");
......
......@@ -23,7 +23,7 @@
#include <kcolorbutton.h>
#include <QDebug>
#include <kmessagebox.h>
#include <knuminput.h>
#include <QDoubleSpinBox>
#include <ktemporaryfile.h>
#include <kurl.h>
......@@ -38,16 +38,16 @@ AddCatDialogUI::AddCatDialogUI( QWidget *parent ) : QFrame( parent ) {
}
AddCatDialog::AddCatDialog( KStars *_ks )
: KDialog( ( QWidget* )_ks )
: QDialog( ( QWidget* )_ks )
{
QDir::setCurrent( QDir::homePath() );
acd = new AddCatDialogUI(this);
setMainWidget(acd);
setCaption( xi18n( "Import Catalog" ) );
setButtons( KDialog::Help|KDialog::Ok|KDialog::Cancel );
setWindowTitle( xi18n( "Import Catalog" ) );
setButtons( QDialog::Help|QDialog::Ok|QDialog::Cancel );
connect( acd->DataURL->lineEdit(), SIGNAL( lostFocus() ), this, SLOT( slotShowDataFile() ) );
connect( acd->DataURL, SIGNAL( urlSelected( const KUrl & ) ),
connect( acd->DataURL, SIGNAL( urlSelected( const QUrl & ) ),
this, SLOT( slotShowDataFile() ) );
connect( acd->PreviewButton, SIGNAL( clicked() ), this, SLOT( slotPreviewCatalog() ) );
connect( this, SIGNAL( okClicked() ), this, SLOT( slotCreateCatalog() ) );
......@@ -74,7 +74,7 @@ AddCatDialog::~AddCatDialog(){
void AddCatDialog::slotOk() {
//Overriding slotOk() so that custom data file can be validated before
//KDialog::accept() is emitted and the window is closed.
//QDialog::accept() is emitted and the window is closed.
//the validation code needs to be aware of AddCatDialog members, so I will just
//emit the okClicked() signal, which is connected to AddCatDialog::validateFile()
......@@ -208,7 +208,7 @@ void AddCatDialog::slotCreateCatalog() {
//Warn user if file exists!
if ( QFile::exists( acd->CatalogURL->url().toLocalFile() ) )
{
KUrl u( acd->CatalogURL->url() );
QUrl u( acd->CatalogURL->url() );
int r=KMessageBox::warningContinueCancel( 0,
xi18n( "A file named \"%1\" already exists. "
"Overwrite it?", u.fileName() ),
......@@ -230,7 +230,7 @@ void AddCatDialog::slotCreateCatalog() {
KStarsData::Instance()->skyComposite()->addCustomCatalog(OutFile.fileName(), 0);
emit KDialog::accept();
emit QDialog::accept();
close();
}
}
......
......@@ -18,7 +18,7 @@
#ifndef ADDCATDIALOG_H_
#define ADDCATDIALOG_H_
#include <kdialog.h>
#include <QDialog>
#include <klineedit.h>
#include <kurlrequester.h>
......@@ -39,7 +39,7 @@ public:
*@author Jason Harris
*@version 1.0
*/
class AddCatDialog : public KDialog {
class AddCatDialog : public QDialog {
Q_OBJECT
public:
/**
......@@ -80,13 +80,13 @@ private slots:
void slotPreviewCatalog();
/**
*Overridden from KDialog to show short help in a dialog rather
*Overridden from QDialog to show short help in a dialog rather
*than launch KHelpCenter.
*/
void slotHelp();
/**
*Overridden from KDialog, so that the entered file can be parsed
*Overridden from QDialog, so that the entered file can be parsed
*before window is closed.
*/
void slotOk();
......
......@@ -30,7 +30,7 @@
<number>10</number>
</property>
<item>
<widget class="KUrlRequester" name="DataURL">
<widget class="QUrlRequester" name="DataURL">
<property name="toolTip">
<string>Enter import data filename</string>
</property>
......@@ -152,7 +152,7 @@
<widget class="QLineEdit" name="Prefix"/>
</item>
<item row="0" column="1">
<widget class="KDoubleNumInput" name="Epoch">
<widget class="QDoubleSpinBox" name="Epoch">
<property name="toolTip">
<string>The coordinate epoch for the catalog</string>
</property>
......@@ -257,7 +257,7 @@
<number>6</number>
</property>
<item row="1" column="1">
<widget class="KUrlRequester" name="CatalogURL">
<widget class="QUrlRequester" name="CatalogURL">
<property name="toolTip">
<string>Enter the filename for the output catalog file</string>
</property>
......@@ -290,9 +290,9 @@
</widget>
<customwidgets>
<customwidget>
<class>KDoubleNumInput</class>
<class>QDoubleSpinBox</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
<header>QDoubleSpinBox</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
......@@ -315,7 +315,7 @@
<header>klistwidget.h</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<class>QUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
</customwidget>
......
......@@ -15,7 +15,7 @@
* *
***************************************************************************/
#include "addlinkdialog.h"
#include "addlinQDialog"
#include <kurl.h>
#include <kmessagebox.h>
......@@ -29,12 +29,12 @@ AddLinkDialogUI::AddLinkDialogUI( QWidget *parent ) : QFrame( parent ) {
}
AddLinkDialog::AddLinkDialog( QWidget *parent, const QString &oname )
: KDialog( parent ), ObjectName( oname )
: QDialog( parent ), ObjectName( oname )
{
ald = new AddLinkDialogUI(this);
setMainWidget( ald );
setCaption( xi18n( "Add Custom URL to %1", oname ) );
setButtons( KDialog::Ok|KDialog::Cancel );
setWindowTitle( xi18n( "Add Custom URL to %1", oname ) );
setButtons( QDialog::Ok|QDialog::Cancel );
//connect signals to slots
connect( ald->URLButton, SIGNAL( clicked() ), this, SLOT( checkURL() ) );
......@@ -45,7 +45,7 @@ AddLinkDialog::AddLinkDialog( QWidget *parent, const QString &oname )
}
void AddLinkDialog::checkURL( void ) {
KUrl _url ( url() );
QUrl _url ( url() );
if ( _url.isValid() ) { //Is the string a valid URL?
KToolInvocation::invokeBrowser( _url.url() ); //If so, launch the browser to see if it's the correct document
} else { //If not, print a warning message box that offers to open the browser to a search engine.
......
/***************************************************************************
addlinkdialog.h - K Desktop Planetarium
addlinQDialog - K Desktop Planetarium
-------------------
begin : Sun Oct 21 2001
copyright : (C) 2001 by Jason Harris
......@@ -19,11 +19,11 @@
#define ADDLINKDIALOG_H_
#include <QVBoxLayout>
#include <kdialog.h>
#include <QDialog>
#include <klineedit.h>
#include <klocale.h>
#include "ui_addlinkdialog.h"
#include "ui_addlinQDialog"
class QString;
......@@ -38,7 +38,7 @@ public:
*@author Jason Harris
*@version 1.0
*/
class AddLinkDialog : public KDialog {
class AddLinkDialog : public QDialog {
Q_OBJECT
public:
/**
......
......@@ -34,7 +34,7 @@
#include <kio/netaccess.h>
#include "kstars.h"
#include "qDebug"
#include <QDebug>
#include "kstarsdata.h"
#include "kstarsdatetime.h"
#include "ksnumbers.h"
......@@ -53,11 +53,11 @@
#include "thumbnailpicker.h"
#include "Options.h"
#include "widgets/kshelplabel.h"
#include "addlinkdialog.h"
#include "addlinQDialog"
#include <config-kstars.h>
#ifdef HAVE_INDI_H
#ifdef HAVE_INDI
#include <basedevice.h>
#include <KLocale>
#include <QStandardPaths>
......@@ -84,8 +84,8 @@ DetailDialog::DetailDialog(SkyObject *o, const KStarsDateTime &ut, GeoLocation *
//Create thumbnail image
Thumbnail = new QPixmap( 200, 200 );
setCaption( xi18n( "Object Details" ) );
setButtons( KDialog::Close );
setWindowTitle( xi18n( "Object Details" ) );
setButtons( QDialog::Close );
createGeneralTab();
createPositionTab( ut, geo );
......@@ -108,7 +108,7 @@ void DetailDialog::createGeneralTab()
//Connections
connect( Data->ObsListButton, SIGNAL( clicked() ), this, SLOT( addToObservingList() ) );
connect( Data->CenterButton, SIGNAL( clicked() ), this, SLOT( centerMap() ) );
#ifdef HAVE_INDI_H
#ifdef HAVE_INDI
connect( Data->ScopeButton, SIGNAL( clicked() ), this, SLOT( centerTelescope() ) );
#else
Data->ScopeButton->setEnabled(false);
......@@ -147,7 +147,7 @@ void DetailDialog::createGeneralTab()
}
objecttyp = s->sptype() + ' ' + xi18n("star");
Data->Magnitude->setText( xi18nc( "number in magnitudes", "%1 mag" ,
KLocale::global()->formatNumber( s->mag(), 2 ) ) ); //show to hundredth place
QLocale().toString( s->mag(), 2 ) ) ); //show to hundredth place
Data->BVLabel->setVisible( true );
Data->BVIndex->setVisible( true );
......@@ -164,13 +164,13 @@ void DetailDialog::createGeneralTab()
Data->Distance->setText( QString(xi18nc("larger than 2000 parsecs", "> 2000 pc") ) );
else if ( s->distance() > 50.0 ) //show to nearest integer
Data->Distance->setText( xi18nc( "number in parsecs", "%1 pc" ,
KLocale::global()->formatNumber( s->distance(), 0 ) ) );
QLocale().toString( s->distance(), 0 ) ) );
else if ( s->distance() > 10.0 ) //show to tenths place
Data->Distance->setText( xi18nc( "number in parsecs", "%1 pc" ,
KLocale::global()->formatNumber( s->distance(), 1 ) ) );
QLocale().toString( s->distance(), 1 ) ) );
else //show to hundredths place
Data->Distance->setText( xi18nc( "number in parsecs", "%1 pc" ,
KLocale::global()->formatNumber( s->distance(), 2 ) ) );
QLocale().toString( s->distance(), 2 ) ) );
//Note multiplicity/variablility in angular size label
Data->AngSizeLabel->setText( QString() );
......@@ -206,36 +206,36 @@ void DetailDialog::createGeneralTab()
if ( selectedObject->name() == "Moon" ) {
Data->IllumLabel->setVisible( true );
Data->Illumination->setVisible( true );
Data->Illumination->setText( QString("%1 %").arg( KLocale::global()->formatNumber( ((KSMoon *)selectedObject)->illum()*100., 0 ) ) );
Data->Illumination->setText( QString("%1 %").arg( QLocale().toString( ((KSMoon *)selectedObject)->illum()*100., 0 ) ) );
((KSMoon *)selectedObject)->updateMag();
}
if(selectedObject->type() == SkyObject::COMET){
Data->Magnitude->setText( xi18nc( "number in magnitudes", "%1 mag" ,
KLocale::global()->formatNumber( ((KSComet *)selectedObject)->getTotalMagnitudeParameter(), 2 ) ) ); //show to hundredth place
QLocale().toString( ((KSComet *)selectedObject)->getTotalMagnitudeParameter(), 2 ) ) ); //show to hundredth place
}
else{
Data->Magnitude->setText( xi18nc( "number in magnitudes", "%1 mag" ,
KLocale::global()->formatNumber( ps->mag(), 2 ) ) ); //show to hundredth place
QLocale().toString( ps->mag(), 2 ) ) ); //show to hundredth place
}
//Distance from Earth. The moon requires a unit conversion
if ( ps->name() == "Moon" ) {
Data->Distance->setText( xi18nc("distance in kilometers", "%1 km",
KLocale::global()->formatNumber( ps->rearth()*AU_KM ) ) );
QLocale().toString( ps->rearth()*AU_KM ) ) );
} else {
Data->Distance->setText( xi18nc("distance in Astronomical Units", "%1 AU",
KLocale::global()->formatNumber( ps->rearth() ) ) );
QLocale().toString( ps->rearth() ) ) );
}
//Angular size; moon and sun in arcmin, others in arcsec
if ( ps->angSize() ) {
if ( ps->name() == "Sun" || ps->name() == "Moon" )
Data->AngSize->setText( xi18nc("angular size in arcminutes", "%1 arcmin",
KLocale::global()->formatNumber( ps->angSize() ) ) ); // Needn't be a plural form because sun / moon will never contract to 1 arcminute
QLocale().toString( ps->angSize() ) ) ); // Needn't be a plural form because sun / moon will never contract to 1 arcminute
else
Data->AngSize->setText( xi18nc("angular size in arcseconds","%1 arcsec",
KLocale::global()->formatNumber( ps->angSize()*60.0 ) ) );
QLocale().toString( ps->angSize()*60.0 ) ) );
} else {
Data->AngSize->setText( "--" );
}
......@@ -248,7 +248,7 @@ void DetailDialog::createGeneralTab()
Data->Names->setText(sup->name());
Data->Magnitude->setText( xi18nc( "number in magnitudes", "%1 mag" ,
KLocale::global()->formatNumber( sup->mag(), 2 ) ) );
QLocale().toString( sup->mag(), 2 ) ) );
Data->Distance->setText( "---" );
break;
......@@ -287,13 +287,13 @@ void DetailDialog::createGeneralTab()
{
Data->MagLabel->setText(xi18nc("integrated flux at a frequency", "Flux(%1):", dso->customCatalog()->fluxFrequency()));
Data->Magnitude->setText( xi18nc( "integrated flux value", "%1 %2" ,
KLocale::global()->formatNumber( dso->flux(), 1 ), dso->customCatalog()->fluxUnit()) ); //show to tenths place
QLocale().toString( dso->flux(), 1 ), dso->customCatalog()->fluxUnit()) ); //show to tenths place
}
else if ( dso->mag() > 90.0 )
Data->Magnitude->setText( "--" );
else
Data->Magnitude->setText( xi18nc( "number in magnitudes", "%1 mag" ,
KLocale::global()->formatNumber( dso->mag(), 1 ) ) ); //show to tenths place
QLocale().toString( dso->mag(), 1 ) ) ); //show to tenths place