diff --git a/kstars/auxiliary/kswizard.cpp b/kstars/auxiliary/kswizard.cpp index 8779ad8cc..3facbce3b 100644 --- a/kstars/auxiliary/kswizard.cpp +++ b/kstars/auxiliary/kswizard.cpp @@ -1,516 +1,575 @@ /*************************************************************************** kswizard.cpp - description ------------------- begin : Wed 28 Jan 2004 copyright : (C) 2004 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * 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 "kswizard.h" #include "ksutils.h" #include #include #include #include #include #include #include #include #include "kspaths.h" #include "kstarsdata.h" #include "geolocation.h" #include "widgets/dmsbox.h" namespace { bool hasPrefix(QString str, QString prefix) { if( prefix.isEmpty() ) return true; return str.startsWith( prefix, Qt::CaseInsensitive ); } } WizWelcomeUI::WizWelcomeUI( QWidget *parent ) : QFrame( parent ) { setupUi( this ); } WizLocationUI::WizLocationUI( QWidget *parent ) : QFrame( parent ) { setupUi( this ); } WizDownloadUI::WizDownloadUI( QWidget *parent ) : QFrame( parent ) { setupUi( this ); } #ifdef Q_OS_OSX WizDataUI::WizDataUI( QWidget *parent ) : QFrame( parent ) { setupUi( this ); } WizAstrometryUI::WizAstrometryUI( QWidget *parent ) : QFrame( parent ) { setupUi( this ); } #endif KSWizard::KSWizard( QWidget *parent ) : QDialog( parent ) { #ifdef Q_OS_OSX setWindowFlags(Qt::Dialog|Qt::WindowStaysOnTopHint); #endif wizardStack = new QStackedWidget( this ); adjustSize(); setWindowTitle( i18n("Setup Wizard") ); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(wizardStack); setLayout(mainLayout); buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal); nextB = new QPushButton(i18n("&Next >")); nextB->setDefault(true); backB = new QPushButton(i18n("< &Back")); backB->setEnabled(false); buttonBox->addButton(backB, QDialogButtonBox::ActionRole); buttonBox->addButton(nextB, QDialogButtonBox::ActionRole); mainLayout->addWidget(buttonBox); welcome = new WizWelcomeUI( wizardStack ); #ifdef Q_OS_OSX data = new WizDataUI( wizardStack ); astrometry = new WizAstrometryUI( wizardStack ); #endif location = new WizLocationUI( wizardStack ); WizDownloadUI* download = new WizDownloadUI( wizardStack ); wizardStack->addWidget( welcome ); #ifdef Q_OS_OSX wizardStack->addWidget( data ); wizardStack->addWidget( astrometry ); #endif wizardStack->addWidget( location ); wizardStack->addWidget( download ); wizardStack->setCurrentWidget( welcome ); //Load images into banner frames. QPixmap im; if( im.load(KSPaths::locate(QStandardPaths::GenericDataLocation, "wzstars.png")) ) welcome->Banner->setPixmap( im ); else if( im.load(QDir(QCoreApplication::applicationDirPath()+"/../Resources/data").absolutePath()+"/wzstars.png")) welcome->Banner->setPixmap( im ); if( im.load(KSPaths::locate(QStandardPaths::GenericDataLocation, "wzgeo.png")) ) location->Banner->setPixmap( im ); else if( im.load(QDir(QCoreApplication::applicationDirPath()+"/../Resources/data").absolutePath()+"/wzgeo.png")) location->Banner->setPixmap( im ); if( im.load(KSPaths::locate(QStandardPaths::GenericDataLocation, "wzdownload.png")) ) download->Banner->setPixmap( im ); else if( im.load(QDir(QCoreApplication::applicationDirPath()+"/../Resources/data").absolutePath()+"/wzdownload.png")) download->Banner->setPixmap( im ); #ifdef Q_OS_OSX if( im.load(KSPaths::locate(QStandardPaths::GenericDataLocation, "wzdownload.png")) ) data->Banner->setPixmap( im ); else if( im.load(QDir(QCoreApplication::applicationDirPath()+"/../Resources/data").absolutePath()+"/wzdownload.png")) data->Banner->setPixmap( im ); if( im.load(KSPaths::locate(QStandardPaths::GenericDataLocation, "wzdownload.png")) ) astrometry->Banner->setPixmap( im ); else if( im.load(QDir(QCoreApplication::applicationDirPath()+"/../Resources/data").absolutePath()+"/wzdownload.png")) astrometry->Banner->setPixmap( im ); data->dataPath->setText(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString(), QStandardPaths::LocateDirectory)+"kstars"); slotUpdateDataButtons(); astrometry->astrometryPath->setText(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString(), QStandardPaths::LocateDirectory)+"Astrometry"); updateAstrometryButtons(); connect(data->copyKStarsData, SIGNAL(clicked()), this, SLOT(slotOpenOrCopyKStarsDataDirectory())); connect(astrometry->astrometryButton, SIGNAL(clicked()), this, SLOT(slotOpenOrCreateAstrometryFolder())); + connect(data->installGSC, SIGNAL(clicked()), this, SLOT(slotInstallGSC())); connect(astrometry->pipInstall, SIGNAL(clicked()), this, SLOT(slotInstallPip())); connect(astrometry->pyfitsInstall, SIGNAL(clicked()), this, SLOT(slotInstallPyfits())); connect(astrometry->netpbmInstall, SIGNAL(clicked()), this, SLOT(slotInstallNetpbm())); connect(this,SIGNAL(accepted()),this,SLOT(slotFinishWizard())); install = new QProcess(this); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString path=env.value("PATH",""); env.insert("PATH","/usr/local/bin:" + path); install->setProcessEnvironment(env); install->setProcessChannelMode ( QProcess::MergedChannels ); connect(install, SIGNAL(readyReadStandardOutput()), this, SLOT(slotUpdateText())); connect(install, SIGNAL(readyReadStandardError()), this, SLOT(slotUpdateText())); connect(install, SIGNAL(finished(int)), this, SLOT(slotInstallerFinished())); + gscMonitor = new QProgressIndicator(data); + data->GSCLayout->addWidget(gscMonitor); + data->downloadProgress->setValue(0); + data->downloadProgress->setEnabled(false); + data->downloadProgress->setVisible(false); installMonitor = new QProgressIndicator(astrometry); astrometry->installersLayout->addWidget(installMonitor); astrometry->programOutput->appendPlainText("Available Paths:"); astrometry->programOutput->appendPlainText(env.value("PATH","No Paths!")); astrometry->programOutput->appendPlainText("🔭 Installer Ready!\n"); #endif //connect signals/slots connect(nextB, SIGNAL(clicked()), this, SLOT(slotNextPage())); connect(backB, SIGNAL(clicked()), this, SLOT(slotPrevPage())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect( location->CityListBox, SIGNAL( itemSelectionChanged () ), this, SLOT( slotChangeCity() ) ); connect( location->CityFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotFilterCities() ) ); connect( location->ProvinceFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotFilterCities() ) ); connect( location->CountryFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotFilterCities() ) ); connect( download->DownloadButton, SIGNAL( clicked() ), this, SLOT( slotDownload() ) ); //Initialize Geographic Location page if(KStars::Instance()) initGeoPage(); } //Do NOT delete members of filteredCityList! They are not created by KSWizard. KSWizard::~KSWizard() {} void KSWizard::setButtonsEnabled() { nextB->setEnabled(wizardStack->currentIndex() < wizardStack->count()-1 ); backB->setEnabled(wizardStack->currentIndex() > 0 ); #ifdef Q_OS_OSX - if((wizardStack->currentWidget()==data||wizardStack->currentWidget()==welcome) &&(!dataDirExists())){ + buttonBox->button(QDialogButtonBox::Ok)->setEnabled(dataDirExists()); + if((wizardStack->currentWidget()==data) &&(!dataDirExists())){ nextB->setEnabled(false); - buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); } if(wizardStack->currentWidget()==location){ if(KStars::Instance()){ if(location->LongBox->isReadOnly()==false){ initGeoPage(); } } } #endif } void KSWizard::slotNextPage() { wizardStack->setCurrentIndex( wizardStack->currentIndex() + 1 ); setButtonsEnabled(); } void KSWizard::slotPrevPage() { wizardStack->setCurrentIndex( wizardStack->currentIndex() - 1 ); setButtonsEnabled(); } void KSWizard::initGeoPage() { KStarsData* data = KStarsData::Instance(); location->LongBox->setReadOnly( true ); location->LatBox->setReadOnly( true ); //Populate the CityListBox //flag the ID of the current City foreach ( GeoLocation *loc, data->getGeoList() ) { location->CityListBox->addItem( loc->fullName() ); filteredCityList.append( loc ); if ( loc->fullName() == data->geo()->fullName() ) { Geo = loc; } } //Sort alphabetically location->CityListBox->sortItems(); //preset to current city location->CityListBox->setCurrentItem(location->CityListBox->findItems(QString(data->geo()->fullName()), Qt::MatchExactly).at(0)); } void KSWizard::slotChangeCity() { if ( location->CityListBox->currentItem() ) { for ( int i=0; i < filteredCityList.size(); ++i ) { if ( filteredCityList[i]->fullName() == location->CityListBox->currentItem()->text() ) { Geo = filteredCityList[i]; break; } } location->LongBox->showInDegrees( Geo->lng() ); location->LatBox->showInDegrees( Geo->lat() ); } } void KSWizard::slotFilterCities() { location->CityListBox->clear(); //Do NOT delete members of filteredCityList! filteredCityList.clear(); foreach ( GeoLocation *loc, KStarsData::Instance()->getGeoList() ) { if( hasPrefix( loc->translatedName(), location->CityFilter->text() ) && hasPrefix( loc->translatedCountry(), location->CountryFilter->text() ) && hasPrefix( loc->translatedProvince(), location->ProvinceFilter->text() ) ) { location->CityListBox->addItem( loc->fullName() ); filteredCityList.append( loc ); } } location->CityListBox->sortItems(); if ( location->CityListBox->count() > 0 ) // set first item in list as selected location->CityListBox->setCurrentItem( location->CityListBox->item(0) ); } void KSWizard::slotDownload() { KNS3::DownloadDialog dlg; dlg.exec(); } void KSWizard::slotFinishWizard(){ - KStars::Instance()->updateLocationFromWizard(*(geo())); + if(KStars::Instance()) + KStars::Instance()->updateLocationFromWizard(*(geo())); delete this; } void KSWizard::slotOpenOrCopyKStarsDataDirectory(){ #ifdef Q_OS_OSX QString dataLocation=QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kstars", QStandardPaths::LocateDirectory); if(dataLocation.isEmpty()) { QString dataSourceLocation=QDir(QCoreApplication::applicationDirPath()+"/../Resources/data").absolutePath(); if(dataSourceLocation.isEmpty()){ //If there is no default data directory in the app bundle KMessageBox::sorry(0, i18n("Error! There was no default data directory found in the app bundle!")); return; } QDir writableDir; writableDir.mkdir(KSPaths::writableLocation(QStandardPaths::GenericDataLocation)); dataLocation=QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kstars", QStandardPaths::LocateDirectory); if(dataLocation.isEmpty()){ //If there *still* is not a kstars data directory KMessageBox::sorry(0, i18n("Error! There was a problem creating the data directory ~/Library/Application Support/ !")); return; } KSUtils::copyRecursively(dataSourceLocation, dataLocation); + //This will update the next, ok, and copy kstars dir buttons. slotUpdateDataButtons(); //This will let the program load after the data folder is copied hide(); setModal(false); setWindowFlags(Qt::Dialog|Qt::WindowStaysOnTopHint); show(); - - - //Enable the buttons so you can go to the next page or click ok. - nextB->setEnabled(true); - buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); } else{ QUrl path = QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kstars", QStandardPaths::LocateDirectory)); QDesktopServices::openUrl(path); } #endif } void KSWizard::slotOpenOrCreateAstrometryFolder() { #ifdef Q_OS_OSX QString astrometryLocation=QStandardPaths::locate(QStandardPaths::GenericDataLocation, "Astrometry", QStandardPaths::LocateDirectory); if(astrometryLocation.isEmpty()) { KSUtils::configureDefaultAstrometry(); updateAstrometryButtons(); } else{ QUrl path = QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "Astrometry", QStandardPaths::LocateDirectory)); QDesktopServices::openUrl(path); } #endif } +void KSWizard::slotInstallGSC(){ + #ifdef Q_OS_OSX + QString location=QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kstars", QStandardPaths::LocateDirectory); + gscZipPath=location+"/gsc.zip"; + QProcess *downloadGSC=new QProcess(); + downloadGSC->setWorkingDirectory(location); + connect(downloadGSC, SIGNAL(finished(int)), this, SLOT(slotExtractGSC())); + connect(downloadGSC, SIGNAL(finished(int)), this, SLOT(downloadGSC.deleteLater())); + downloadGSC->start("wget", QStringList() << "-O" << "gsc.zip" << "http://mactelescope.com/gsc.zip" ); + data->GSCFeedback->setText("downloading GSC . . ."); + + downloadMonitor=new QTimer(this); + connect(downloadMonitor, SIGNAL(timeout()), this, SLOT(slotCheckDownloadProgress())); + downloadMonitor->start(1000); + gscMonitor->startAnimation(); + data->downloadProgress->setVisible(true); + data->downloadProgress->setEnabled(true); + data->downloadProgress->setMaximum(240); + data->downloadProgress->setValue(0); + #endif +} + +void KSWizard::slotExtractGSC(){ +#ifdef Q_OS_OSX + QString location=QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kstars", QStandardPaths::LocateDirectory); + QProcess *gscExtractor=new QProcess(); + connect(gscExtractor, SIGNAL(finished(int)), this, SLOT(slotGSCInstallerFinished())); + connect(gscExtractor, SIGNAL(finished(int)), this, SLOT(gscExtractor.deleteLater())); + gscExtractor->setWorkingDirectory(location); + gscExtractor->start("unzip", QStringList() << "-ao" << "gsc.zip"); + gscMonitor->startAnimation(); + #endif +} + +void KSWizard::slotCheckDownloadProgress(){ +#ifdef Q_OS_OSX + if(QFileInfo(gscZipPath).exists()); + data->downloadProgress->setValue(QFileInfo(gscZipPath).size()/1048576); +#endif +} + +void KSWizard::slotGSCInstallerFinished(){ +#ifdef Q_OS_OSX + if(downloadMonitor){ + downloadMonitor->stop(); + delete downloadMonitor; + } + data->downloadProgress->setEnabled(false); + data->downloadProgress->setValue(0); + data->downloadProgress->setVisible(false); + gscMonitor->stopAnimation(); + slotUpdateDataButtons(); + if(QFile(gscZipPath).exists()) + QFile(gscZipPath).remove(); +#endif +} + + + void KSWizard::slotInstallPip() { #ifdef Q_OS_OSX astrometry->programOutput->appendPlainText("🔭 INSTALLING PIP:\n"); if(!pythonExists()){ if(brewExists()){ astrometry->programOutput->appendPlainText("/usr/local/bin/brew install python\n"); install->start("/usr/local/bin/brew" , QStringList() << "install" << "python"); installMonitor->startAnimation(); } else KMessageBox::sorry(0,"Python is not installed. Please install python to /usr/local/bin first, or install homebrew and click again.", "", KMessageBox::AllowLink); }else{ if(!pipExists()){ if(brewExists()){ astrometry->programOutput->appendPlainText("/usr/local/bin/brew install python\n"); install->start("/usr/local/bin/brew" , QStringList() << "install" << "python"); installMonitor->startAnimation(); } else if(QProcess::execute("type /usr/local/bin/easy_install")==QProcess::NormalExit){ astrometry->programOutput->appendPlainText("/usr/local/bin/easy_install pip\n"); install->start("/usr/local/bin/easy_install" , QStringList() << "pip"); installMonitor->startAnimation(); } else{ KMessageBox::sorry(0,"pip failed to install with homebrew and easy_install. Try installing homebrew and clicking again.", "", KMessageBox::AllowLink); } } } #endif } void KSWizard::slotInstallPyfits() { #ifdef Q_OS_OSX astrometry->programOutput->appendPlainText("🔭 INSTALLING PYFITS:\n"); if(!pythonExists()){ KMessageBox::sorry(0,"/usr/local/bin/python is not installed. Please install python first."); }else if(!pipExists()){ KMessageBox::sorry(0,"/usr/local/bin/pip is not installed. Please install pip first."); } else{ astrometry->programOutput->appendPlainText("/usr/local/bin/pip install pyfits\n"); install->start("/usr/local/bin/pip" , QStringList() << "install" << "pyfits"); installMonitor->startAnimation(); } #endif } void KSWizard::slotInstallNetpbm() { #ifdef Q_OS_OSX astrometry->programOutput->appendPlainText("🔭 INSTALLING NETPBM:\n"); if(brewExists()){ install->start("/usr/local/bin/brew" , QStringList() << "install" << "netpbm"); installMonitor->startAnimation(); } else{ //install->start("ruby", QStringList() << "-e" << "'$(curl -fsSL raw.githubusercontent.com/Homebrew/install/master/install)'" << "<" << "/dev/null" << "2>" << "/dev/null"); //install->waitForFinished(); //install->start("/usr/local/bin/brew" , QStringList() << "install" << "netpbm"); KMessageBox::sorry(0,"homebrew is not installed. Try installing homebrew and clicking again.", "", KMessageBox::AllowLink); } #endif } void KSWizard::slotUpdateText() { #ifdef Q_OS_OSX QByteArray data = install->readAllStandardOutput(); astrometry->programOutput->appendPlainText(QString(data)); #endif } #ifdef Q_OS_OSX bool KSWizard::dataDirExists(){ QString dataLocation=QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kstars", QStandardPaths::LocateDirectory); return !dataLocation.isEmpty(); } bool KSWizard::astrometryDirExists(){ QString astrometryLocation=QStandardPaths::locate(QStandardPaths::GenericDataLocation, "Astrometry", QStandardPaths::LocateDirectory); return !astrometryLocation.isEmpty(); } bool KSWizard::pythonExists(){ return QProcess::execute("type /usr/local/bin/python")==QProcess::NormalExit; } +bool KSWizard::GSCExists(){ + QString GSCLocation=QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kstars/gsc", QStandardPaths::LocateDirectory); + return !GSCLocation.isEmpty(); +} bool KSWizard::pipExists(){ return QProcess::execute("type /usr/local/bin/pip")==QProcess::NormalExit; } bool KSWizard::pyfitsExists(){ QProcess testPyfits; testPyfits.start("/usr/local/bin/pip list"); testPyfits.waitForFinished(); QString listPip(testPyfits.readAllStandardOutput()); qDebug()<astrometryFound->setChecked(astrometryDirExists()); if(astrometryDirExists()) { - astrometry->astrometryFound->setChecked(true); astrometry->astrometryButton->setText("Open Folder"); astrometry->astrometryFeedback->setText("

To plate solve, you need to put index files in the following folder. See the documentation at this link: Astrometry Readme for details on how to get files.

"); } else{ - astrometry->astrometryFound->setChecked(false); astrometry->astrometryButton->setText("Create Folder"); astrometry->astrometryFeedback->setText("KStars needs to configure the astrometry.cfg file and create a folder for the index files. Please click the button below to complete this task."); } if(!pythonExists()){ astrometry->pipFound->setChecked(false); astrometry->pipInstall->setDisabled(false); astrometry->pyfitsFound->setChecked(false); astrometry->pyfitsInstall->setDisabled(false); } else{ - if(pipExists()){ - astrometry->pipFound->setChecked(true); - astrometry->pipInstall->setDisabled(true); - if(pyfitsExists()){ - astrometry->pyfitsFound->setChecked(true); - astrometry->pyfitsInstall->setDisabled(true); - }else{ - astrometry->pyfitsFound->setChecked(false); - astrometry->pyfitsInstall->setDisabled(false); - } - }else{ - astrometry->pipFound->setChecked(false); - astrometry->pipInstall->setDisabled(false); - astrometry->pyfitsFound->setChecked(false); - astrometry->pyfitsInstall->setDisabled(false); + bool ifPipExists=pipExists(); + astrometry->pipFound->setChecked(ifPipExists); + astrometry->pipInstall->setDisabled(ifPipExists); + if(ifPipExists){ + bool ifPyfitsExists=pyfitsExists(); + astrometry->pyfitsFound->setChecked(ifPyfitsExists); + astrometry->pyfitsInstall->setDisabled(ifPyfitsExists); } } //Testing a random netpbm command. - if(netpbmExists()){ - astrometry->netpbmFound->setChecked(true); - astrometry->netpbmInstall->setDisabled(true); - }else{ - astrometry->netpbmFound->setChecked(false); - astrometry->netpbmInstall->setDisabled(false); - } + bool ifNetpbmExists=netpbmExists(); + astrometry->netpbmFound->setChecked(ifNetpbmExists); + astrometry->netpbmInstall->setDisabled(ifNetpbmExists); } #endif void KSWizard::slotUpdateDataButtons(){ #ifdef Q_OS_OSX + data->dataDirFound->setChecked(dataDirExists()); if(dataDirExists()) { - data->dataDirFound->setChecked(true); data->copyKStarsData->setText("Open KStars Data Directory"); data->foundFeedback1->setText("The KStars Data Directory called kstars is located at:"); data->foundFeedback2->setText("Your data directory was found. If you have any problems with it, you can always delete this data directory and KStars will give you a new data directory. You can click this button to open the data directory, just be careful not to delete any important files."); } else{ - data->dataDirFound->setChecked(false); data->foundFeedback1->setText("The KStars Data Directory called kstars should be located at:"); data->foundFeedback2->setText("

Your data directory was not found. You can click the button below to copy a default KStars data directory to the correct location, or if you have a KStars directory already some place else, you can exit KStars and copy it to that location yourself.

"); } + bool ifGSCExists=GSCExists(); + data->GSCFound->setChecked(ifGSCExists); + data->installGSC->setDisabled(ifGSCExists||!dataDirExists()); + if(ifGSCExists) + data->GSCFeedback->setText("GSC was found on your system. To use it, just take an image in the CCD simulator. To uninstall, just delete the gsc folder from your data directory above."); + setButtonsEnabled(); #endif } void KSWizard::slotInstallerFinished(){ #ifdef Q_OS_OSX astrometry->programOutput->appendPlainText("🔭 Installer Finished!\n"); updateAstrometryButtons(); installMonitor->stopAnimation(); #endif } + diff --git a/kstars/auxiliary/kswizard.h b/kstars/auxiliary/kswizard.h index 56a9f7931..871bbd3e0 100644 --- a/kstars/auxiliary/kswizard.h +++ b/kstars/auxiliary/kswizard.h @@ -1,171 +1,186 @@ /*************************************************************************** kswizard.h - description ------------------- begin : Wed 28 Jan 2004 copyright : (C) 2004 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * 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 KSWIZARD_H_ #define KSWIZARD_H_ #include #include #include #include #include #include "ui_wizwelcome.h" #include "ui_wizlocation.h" #include "ui_wizdownload.h" #include "ui_wizdata.h" #include "ui_wizastrometry.h" #include "ekos/auxiliary/QProgressIndicator.h" class GeoLocation; class QStackedWidget; class WizWelcomeUI : public QFrame, public Ui::WizWelcome { Q_OBJECT public: explicit WizWelcomeUI( QWidget *parent=0 ); }; class WizLocationUI : public QFrame, public Ui::WizLocation { Q_OBJECT public: explicit WizLocationUI( QWidget *parent=0 ); }; class WizDataUI : public QFrame, public Ui::WizData { Q_OBJECT public: explicit WizDataUI( QWidget *parent=0 ); }; class WizAstrometryUI : public QFrame, public Ui::WizAstrometry { Q_OBJECT public: explicit WizAstrometryUI( QWidget *parent=0 ); }; class WizDownloadUI : public QFrame, public Ui::WizDownload { Q_OBJECT public: explicit WizDownloadUI( QWidget *parent=0 ); }; /** @class KSWizard * The Setup Wizard will be automatically opened when KStars runs * for the first time. It allows the user to set up some basic parameters: * @li Geographic Location * @li Download extra data files * @author Jason Harris * @version 1.0 */ class KSWizard : public QDialog { Q_OBJECT public: /** Constructor * @p parent pointer to the parent widget */ explicit KSWizard( QWidget* parent = 0 ); /**Destructor */ virtual ~KSWizard(); /** @return pointer to the geographic location selected by the user */ const GeoLocation* geo() const { return Geo; } private slots: void slotNextPage(); void slotPrevPage(); /** Set the geo pointer to the user's selected city, and display * its longitude and latitude in the window. * @note called when the highlighted city in the list box changes */ void slotChangeCity(); /** Display only those cities which meet the user's search criteria * in the city list box. * @note called when one of the name filters is modified */ void slotFilterCities(); void slotDownload(); void slotFinishWizard(); void slotUpdateText(); void slotOpenOrCreateAstrometryFolder(); + void slotInstallGSC(); + + void slotExtractGSC(); + + void slotCheckDownloadProgress(); + + void slotGSCInstallerFinished(); + void slotInstallPip(); void slotInstallPyfits(); void slotInstallNetpbm(); void slotInstallerFinished(); void slotUpdateDataButtons(); void slotOpenOrCopyKStarsDataDirectory(); private: /** @short Initialize the geographic location page. * Populate the city list box, and highlight the current location in the list. */ void initGeoPage(); /** @short set enabled/disable state of Next/Prev buttins based on current page */ void setButtonsEnabled(); QStackedWidget *wizardStack; WizWelcomeUI* welcome; WizLocationUI *location; WizDataUI* data; WizAstrometryUI* astrometry; QPushButton *nextB,*backB; QDialogButtonBox *buttonBox; - QProcess* install; - QProgressIndicator *installMonitor; + + GeoLocation *Geo; QList filteredCityList; #ifdef Q_OS_OSX + QProcess* install; + QProgressIndicator *installMonitor; + QProgressIndicator *gscMonitor; + QTimer *downloadMonitor; + QString gscZipPath; bool brewExists(); bool pythonExists(); + bool GSCExists(); + bool pipExists(); bool pyfitsExists(); bool netpbmExists(); bool dataDirExists(); bool astrometryDirExists(); void updateAstrometryButtons(); #endif }; #endif diff --git a/kstars/dialogs/wizdata.ui b/kstars/dialogs/wizdata.ui index d9e0a6427..bb3b35031 100644 --- a/kstars/dialogs/wizdata.ui +++ b/kstars/dialogs/wizdata.ui @@ -1,164 +1,214 @@ WizData 0 0 586 395 8 8 8 8 0 0 120 360 Sans Serif 11 75 false true false false KStars Data Directory - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 12 - - - - <html><head/><body><p>The KStars Data Directory called kstars should be located at:</p></body></html> true 10 ~/Library/Application Support/kstars false <html><head/><body><p>Your data directory was not found. You can click the button below to copy a default KStars data directory to the correct location, or if you have a KStars directory already some place else, you can exit KStars and copy it to that location yourself.</p></body></html> true Copy KStars Data Directory - + - <html><head/><body><p>Optional Files for the Data directory:</p><p>GSC: <a href="https://drive.google.com/file/d/0B_ivMJINsdQ8cDhNcU5ESkZMZ0E/view?usp=sharing"><span style=" text-decoration: underline; color:#0000ff;">Guide Star Catalog</span></a></p><p>Installing this in your data directory will enable the CCD Simulator in KStars to take realistic images. This is useful for testing sequences, plate solving, and learning to use KStars. Just unzip the zip file and place the gsc folder in the data directory.</p></body></html> + Optional Files for the Data directory: - - true + + + + + + 10 - + + + + + 0 + 0 + + + + <html><head/><body><p>GSC: <a href="https://drive.google.com/file/d/0B_ivMJINsdQ8cDhNcU5ESkZMZ0E/view?usp=sharing"><span style=" text-decoration: underline; color:#0000ff;">Guide Star Catalog</span></a> (305 MB)</p></body></html> + + + true + + + true + + + + + + + GSC + + + + + + + false + + + + + + + + + + false + + + + 0 + 0 + + + + 240 + + + 0 + + + + + + + + + Installing this in your data directory will enable the CCD Simulator in KStars to take realistic images. This is useful for testing sequences, plate solving, and learning to use KStars. Just click the button to install or unzip the zip file and place the gsc folder in the data directory. + + true Qt::Vertical 20 191