예제 #1
0
static BOOL CALLBACK statusDlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam) 
{
    switch (iMsg) {
    case WM_COMMAND:
        if (LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            return TRUE;
        }
        break;

    case WM_CLOSE:
        return TRUE;

    case WM_TIMER:
        SendDlgItemMessage(hDlg, IDC_VIDEOPROGRESSTEXT, WM_SETTEXT, 0, (LPARAM)progressText());
        if (!boardCaptureIsPlaying()) {
            EndDialog(hDlg, TRUE);
        }
        return FALSE;

    case WM_DESTROY:
        KillTimer(hwnd, 2);
        return 0;

    case WM_INITDIALOG:
        SetWindowText(hDlg, langDlgRenderVideoCapture());
        SendDlgItemMessage(hDlg, IDC_VIDEOPROGRESSTEXT, WM_SETTEXT, 0, (LPARAM)progressText());
        SetTimer(hDlg, 2, 250, NULL);
        return FALSE;
    }

    return FALSE;
}
예제 #2
0
void TimeWidget::updateTime()
{
  // Update progress bar value
  m_widget_progress->setValue( m_widget_progress->value() - 1 );
  if(m_widget_progress->value() == 0)
		countdownReached();

	const auto remaining_secs = remainingSeconds();
	const auto times					= timesFromSeconds(remaining_secs);

  // Update progress bar text
	updateProgressText(times);

	// Update window's title
	updateWindowTitle(progressText(times, true));

  emit countdownUpdated(m_widget_progress->value());
}
예제 #3
0
void StarComponent::reindexAll( KSNumbers *num )
{
    if (  0 && ! m_reindexSplash ) {
        m_reindexSplash = new KStarsSplash(
                                           i18n("Please wait while re-indexing stars...") );
        QObject::connect( KStarsData::Instance(),
                          SIGNAL( progressText( QString ) ),
                          m_reindexSplash, SLOT( setMessage( QString ) ) );

        m_reindexSplash->show();
        m_reindexSplash->raise();
        return;
    }

    printf("Re-indexing Stars to year %4.1f...\n",
           2000.0 + num->julianCenturies() * 100.0);

    m_reindexNum = KSNumbers( *num );
    m_skyMesh->setKSNumbers( num );

    // clear out the old index
    for ( int i = 0; i < m_starIndex->size(); i++ ) {
        m_starIndex->at( i )->clear();
    }

    // re-populate it from the objectList
    int size = m_ObjectList.size();
    for ( int i = 0; i < size; i++ ) {
        StarObject* star = (StarObject*) m_ObjectList[ i ];
        Trixel trixel = m_skyMesh->indexStar( star );
        m_starIndex->at( trixel )->append( star );
    }

    // Let everyone else know we have re-indexed to num
    for ( int j = 0; j < m_highPMStars.size(); j++ ) {
        m_highPMStars.at( j )->setIndexTime( num );
    }

    //delete m_reindexSplash;
    //m_reindexSplash = 0;

    printf("Done.\n");
}
예제 #4
0
bool KStarsData::initialize() {
    //Initialize CatalogDB//
    KStars::Instance()->data()->catalogdb()->Initialize();

    //Load Time Zone Rules//
    emit progressText( i18n("Reading time zone rules") );
    if( !readTimeZoneRulebook( ) ) {
        fatalErrorMessage( "TZrules.dat" );
        return false;
    }

    //Load Cities//
    emit progressText( i18n("Loading city data") );
    if ( !readCityData( ) ) {
        fatalErrorMessage( "Cities.dat" );
        return false;
    }

    //Initialize SkyMapComposite//
    emit progressText(i18n("Loading sky objects" ) );
    m_SkyComposite = new SkyMapComposite(0);

    //Load Image URLs//
    emit progressText( i18n("Loading Image URLs" ) );
    if( !readURLData( "image_url.dat", 0 ) && !nonFatalErrorMessage( "image_url.dat" ) )
        return false;

    //Load Information URLs//
    emit progressText( i18n("Loading Information URLs" ) );
    if( !readURLData( "info_url.dat", 1 ) && !nonFatalErrorMessage( "info_url.dat" ) )
        return false;

    emit progressText( i18n("Loading Variable Stars" ) );

    //Initialize User Database//
    emit progressText( i18n("Loading User Information" ) );
    m_ksuserdb.Initialize();

    readUserLog();

    readADVTreeData();

    return true;
}
예제 #5
0
void TimeWidget::updateProgressText(const TimeParts& times)
{
	m_widget_progress->setFormat(progressText(times));
}
예제 #6
0
파일: main.cpp 프로젝트: lupinix/kstars
int main(int argc, char *argv[])
{
#ifdef KSTARS_LITE
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
    QApplication app(argc, argv);

#ifdef Q_OS_OSX
    //Note, this function will return true on OS X if the data directories are good to go.  If not, quit with error code 1!
    if(!KSUtils::copyDataFolderFromAppBundleIfNeeded()){
        KMessageBox::sorry(0, i18n("Sorry, without a KStars Data Directory, KStars cannot operate. Exiting program now."));
        return 1;
    }
#endif
    app.setApplicationVersion(KSTARS_VERSION);
    /**
    * enable high dpi support
    */
     app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);

    KLocalizedString::setApplicationDomain("kstars");    
#ifndef KSTARS_LITE
    KCrash::initialize();

    KAboutData aboutData( "kstars", i18n("KStars"), KSTARS_VERSION, i18n(description), KAboutLicense::GPL,
                          "2001-" + QString::number(QDate::currentDate().year()) + i18n("(c), The KStars Team"), i18n(notice), "http://edu.kde.org/kstars");
    aboutData.addAuthor(i18n("Jason Harris"), i18n("Original Author"), "*****@*****.**", "http://www.30doradus.org");
    aboutData.addAuthor(i18n("Jasem Mutlaq"), i18n("Current Maintainer"), "*****@*****.**", "http://www.indilib.org");

    // Active developers
    aboutData.addAuthor(i18n("Akarsh Simha"), QString(), "*****@*****.**", "http://www.ph.utexas.edu/~asimha");
    aboutData.addAuthor(i18n("Artem Fedoskin"), i18n("KStars Lite"), "*****@*****.**");
    aboutData.addAuthor(i18n("Robert Lancaster"), i18n("FITSViewer Improvements. KStars OSX Port"), "*****@*****.**");

    // Inactive developers
    aboutData.addAuthor(i18n("James Bowlin"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Pablo de Vicente"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Thomas Kabelmann"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Heiko Evermann"),QString(), "*****@*****.**", "http://www.evermann.de");
    aboutData.addAuthor(i18n("Carsten Niehaus"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Mark Hollomon"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Alexey Khudyakov"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("M&eacute;d&eacute;ric Boquien"), QString(), "*****@*****.**");    
    aboutData.addAuthor(i18n("J&eacute;r&ocirc;me Sonrier"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Prakash Mohan"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Victor Cărbune"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Henry de Valence"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Samikshan Bairagya"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Rafał Kułaga"), QString(), "*****@*****.**");
    aboutData.addAuthor(i18n("Rishab Arora"), QString(), "*****@*****.**");

    // Contributors
    aboutData.addCredit(i18n("Valery Kharitonov"), i18n("Converted labels containing technical terms to links to documentation") );
    aboutData.addCredit(i18n("Ana-Maria Constantin"), i18n("Technical documentation on Astronomy and KStars") );
    aboutData.addCredit(i18n("Andrew Stepanenko"), i18n("Guiding code based on lin_guider") );
    aboutData.addCredit(i18n("Nuno Pinheiro"), i18n("Artwork") );
    aboutData.addCredit(i18n("Utkarsh Simha"), i18n("Improvements to observation plan execution, star hopper etc.") );
    aboutData.addCredit(i18n("Daniel Holler"), i18n("Extensive testing and suggestions for Ekos/INDI.") );
    aboutData.addCredit(i18n("Stephane Lucas"), i18n("Extensive testing and suggestions for Ekos Scheduler.") );
    aboutData.addCredit(i18n("Yuri Fabirovsky"), i18n("Splash screen for both regular KStars and KStars Lite.") );

    KAboutData::setApplicationData(aboutData);

    QCommandLineParser parser;
    aboutData.setupCommandLine(&parser);
    parser.setApplicationDescription(aboutData.shortDescription());
    parser.addVersionOption();
    parser.addHelpOption();

    //parser.addHelpOption(INSERT_DESCRIPTION_HERE);
    parser.addOption(QCommandLineOption(QStringList() << "dump", i18n( "Dump sky image to file" )));
    parser.addOption(QCommandLineOption(QStringList() << "script ", i18n( "Script to execute" )));
    parser.addOption(QCommandLineOption(QStringList() << "width ", i18n( "Width of sky image" ),  "640"));
    parser.addOption(QCommandLineOption(QStringList() << "height ", i18n( "Height of sky image" ), "480"));
    parser.addOption(QCommandLineOption(QStringList() << "filename ", i18n( "Filename for sky image" ), "kstars.png"));
    parser.addOption(QCommandLineOption(QStringList() << "date", i18n( "Date and time" )));
    parser.addOption(QCommandLineOption(QStringList() << "paused", i18n( "Start with clock paused" )));

    // urls to open
    parser.addPositionalArgument(QStringLiteral("urls"), i18n("FITS file(s) to open."), QStringLiteral("[urls...]"));

    parser.process(app);
    aboutData.processCommandLine(&parser);

    if ( parser.isSet( "dump" ) )
    {
        qDebug() << "Dumping sky image";

        //parse filename and image format
        const char* format = "PNG";
        QString fname = parser.value( "filename" );
        QString ext = fname.mid( fname.lastIndexOf(".")+1 );
        if ( ext.toLower() == "png" ) { format = "PNG"; }
        else if ( ext.toLower() == "jpg" || ext.toLower() == "jpeg" ) { format = "JPG"; }
        else if ( ext.toLower() == "gif" ) { format = "GIF"; }
        else if ( ext.toLower() == "pnm" ) { format = "PNM"; }
        else if ( ext.toLower() == "bmp" ) { format = "BMP"; }
        else { qWarning() << i18n( "Could not parse image format of %1; assuming PNG.", fname ) ; }

        //parse width and height
        bool ok(false);
        int w(0), h(0);
        w = parser.value( "width" ).toInt( &ok );
        if ( ok ) h =  parser.value( "height" ).toInt( &ok );
        if ( !ok ) {
            qWarning() << "Unable to parse arguments: " ;
            qWarning() << "Width: " << parser.value( "width" )
                       << "  Height: " << parser.value( "height" ) << endl;
            return 1;
        }
        KStarsData *dat = KStarsData::Create();
        QObject::connect( dat, SIGNAL( progressText(QString) ), dat, SLOT( slotConsoleMessage(QString) ) );
        dat->initialize();

        //Set Geographic Location
        dat->setLocationFromOptions();

        //Set color scheme
        dat->colorScheme()->loadFromConfig();

        //set clock now that we have a location:
        //Check to see if user provided a date/time string.  If not, use current CPU time
        QString datestring = parser.value( "date" );
        KStarsDateTime kdt;
        if ( ! datestring.isEmpty() ) {
            if ( datestring.contains( "-" ) ) { //assume ISODate format
                if ( datestring.contains( ":" ) ) { //also includes time
                    //kdt = QDateTime::fromString( datestring, QDateTime::ISODate );
                    kdt = QDateTime::fromString( datestring, Qt::ISODate );
                } else { //string probably contains date only
                    //kdt.setDate( QDate::fromString( datestring, Qt::ISODate ) );
                    kdt.setDate( QDate::fromString( datestring, Qt::ISODate ) );
                    kdt.setTime( QTime( 0, 0, 0 ) );
                }
            } else { //assume Text format for date string
                kdt = dat->geo()->LTtoUT( QDateTime::fromString( datestring, Qt::TextDate ) );
            }

            if ( ! kdt.isValid() ) {
                qWarning() << i18n( "Using CPU date/time instead." ) ;

                kdt = KStarsDateTime::currentDateTimeUtc();
            }
        } else {
            kdt = KStarsDateTime::currentDateTimeUtc();
        }
        dat->clock()->setUTC( kdt );

        SkyMap *map = SkyMap::Create();
        map->resize( w, h );
        QPixmap sky( w, h );

        dat->setFullTimeUpdate();
        dat->updateTime(dat->geo(), map );

        SkyPoint dest( Options::focusRA(), Options::focusDec() );
        map->setDestination( dest );
        map->destination()->EquatorialToHorizontal( dat->lst(), dat->geo()->lat() );
        map->setFocus( map->destination() );
        map->focus()->EquatorialToHorizontal( dat->lst(), dat->geo()->lat() );

        //Execute the specified script
        QString scriptfile = parser.value( "script" );
        if ( ! scriptfile.isEmpty() ) {
            if ( dat->executeScript( scriptfile, map ) ) {
                std::cout << i18n( "Script executed." ).toUtf8().data() << std::endl;
            } else {
                qWarning() << i18n( "Could not execute script." ) ;
            }
        }

        qApp->processEvents();
        map->setupProjector();
        map->exportSkyImage( &sky );
        qApp->processEvents();

        if ( ! sky.save( fname, format ) )
            qWarning() << "Unable to save image: " << fname;
        else
            qDebug() << "Saved to file: %1" << fname;

        delete map;
        delete dat;
        return 0;
    }

    //Try to parse the given date string
    QString datestring = parser.value( "date" );

    if ( ! datestring.isEmpty() && ! KStarsDateTime::fromString( datestring ).isValid() )
    {
        qWarning() << i18n( "Using CPU date/time instead." ) ;
        datestring.clear();
    }

#endif
    // Create writable data dir if it does not exist
    QDir writableDir;
    writableDir.mkdir(KSPaths::writableLocation(QStandardPaths::GenericDataLocation));
#ifndef KSTARS_LITE

    KStars::createInstance( true, ! parser.isSet( "paused" ), datestring );

    // no session.. just start up normally
    const QStringList urls = parser.positionalArguments();

    // take arguments
    if( ! urls.isEmpty() )
    {
        foreach (const QString &url, urls) {
            const QUrl u = QUrl::fromUserInput(url, QDir::currentPath());
            KStars::Instance()->openFITS(u);
        }
    }
예제 #7
0
int main(int argc, char *argv[])
{
    KAboutData aboutData( "kstars", 0, ki18n("KStars"),
                          KSTARS_VERSION, ki18n(description), KAboutData::License_GPL,
                          ki18n("(c) 2001-2012, The KStars Team"), ki18n(notice), "http://edu.kde.org/kstars");
    aboutData.addAuthor(ki18n("Jason Harris"),KLocalizedString(), "*****@*****.**", "http://www.30doradus.org");
    aboutData.addAuthor(ki18n("Jasem Mutlaq"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("James Bowlin"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Pablo de Vicente"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Thomas Kabelmann"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Heiko Evermann"),KLocalizedString(), "*****@*****.**", "http://www.evermann.de");
    aboutData.addAuthor(ki18n("Carsten Niehaus"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Mark Hollomon"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Alexey Khudyakov"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("M&eacute;d&eacute;ric Boquien"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Akarsh Simha"), KLocalizedString(), "*****@*****.**", "http://www.ph.utexas.edu/~asimha");
    aboutData.addAuthor(ki18n("J&eacute;r&ocirc;me Sonrier"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Prakash Mohan"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Victor Cărbune"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Henry de Valence"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Samikshan Bairagya"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Rafał Kułaga"), KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Rishab Arora"), KLocalizedString(), "*****@*****.**");

    aboutData.addCredit(ki18n("Valery Kharitonov"), ki18n("Converted labels containing technical terms to links to documentation") );
    aboutData.addCredit(ki18n("Ana-Maria Constantin"), ki18n("Technical documentation on Astronomy and KStars") );
    aboutData.addCredit(ki18n("Andrew Stepanenko"), ki18n("Guiding code based on lin_guider") );
    aboutData.addCredit(ki18n("Nuno Pinheiro"), ki18n("Artwork") );

    KCmdLineArgs::init( argc, argv, &aboutData );

    KCmdLineOptions options;
    options.add("!dump", ki18n( "Dump sky image to file" ));
    options.add("script ", ki18n( "Script to execute" ));
    options.add("width ", ki18n( "Width of sky image" ), "640");
    options.add("height ", ki18n( "Height of sky image" ), "480");
    options.add("filename ", ki18n( "Filename for sky image" ), "kstars.png");
    options.add("date ", ki18n( "Date and time" ));
    options.add("!paused", ki18n( "Start with clock paused" ));
    KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    KApplication a;

    if ( args->isSet( "dump" ) ) {
        kDebug() << i18n( "Dumping sky image" );

        //parse filename and image format
        const char* format = "PNG";
        QString fname = args->getOption( "filename" );
        QString ext = fname.mid( fname.lastIndexOf(".")+1 );
        if ( ext.toLower() == "png" ) { format = "PNG"; }
        else if ( ext.toLower() == "jpg" || ext.toLower() == "jpeg" ) { format = "JPG"; }
        else if ( ext.toLower() == "gif" ) { format = "GIF"; }
        else if ( ext.toLower() == "pnm" ) { format = "PNM"; }
        else if ( ext.toLower() == "bmp" ) { format = "BMP"; }
        else { kWarning() << i18n( "Could not parse image format of %1; assuming PNG.", fname ) ; }

        //parse width and height
        bool ok(false);
        int w(0), h(0);
        w = args->getOption( "width" ).toInt( &ok );
        if ( ok ) h =  args->getOption( "height" ).toInt( &ok );
        if ( !ok ) {
            kWarning() << "Unable to parse arguments: " ;
            kWarning() << "Width: " << args->getOption( "width" )
            << "  Height: " << args->getOption( "height" ) << endl;
            return 1;
        }

        KStarsData *dat = KStarsData::Create();
        QObject::connect( dat, SIGNAL( progressText(QString) ), dat, SLOT( slotConsoleMessage(QString) ) );
        dat->initialize();

        //Set Geographic Location
        dat->setLocationFromOptions();

        //Set color scheme
        dat->colorScheme()->loadFromConfig();

        //set clock now that we have a location:
        //Check to see if user provided a date/time string.  If not, use current CPU time
        QString datestring = args->getOption( "date" );
        KStarsDateTime kdt;
        if ( ! datestring.isEmpty() ) {
            if ( datestring.contains( "-" ) ) { //assume ISODate format
                if ( datestring.contains( ":" ) ) { //also includes time
                    kdt = KDateTime::fromString( datestring, KDateTime::ISODate );
                } else { //string probably contains date only
                    kdt.setDate( QDate::fromString( datestring, Qt::ISODate ) );
                    kdt.setTime( QTime( 0, 0, 0 ) );
                }
            } else { //assume Text format for date string
                kdt = dat->geo()->LTtoUT( KDateTime::fromString( datestring, KDateTime::QtTextDate ) );
            }

            if ( ! kdt.isValid() ) {
                kWarning() << i18n( "Using CPU date/time instead." ) ;

                kdt = KStarsDateTime::currentUtcDateTime();
            }
        } else {
            kdt = KStarsDateTime::currentUtcDateTime();
        }
        dat->clock()->setUTC( kdt );

        KSNumbers num( dat->ut().djd() );
        //		dat->initGuides(&num);

        SkyMap *map = SkyMap::Create();
        map->resize( w, h );
        QPixmap sky( w, h );

        dat->setFullTimeUpdate();
        dat->updateTime(dat->geo(), map );

        SkyPoint dest( Options::focusRA(), Options::focusDec() );
        map->setDestination( dest );
        map->destination()->EquatorialToHorizontal( dat->lst(), dat->geo()->lat() );
        map->setFocus( map->destination() );
        map->focus()->EquatorialToHorizontal( dat->lst(), dat->geo()->lat() );

        //Execute the specified script
        QString scriptfile = args->getOption( "script" );
        if ( ! scriptfile.isEmpty() ) {
            if ( dat->executeScript( scriptfile, map ) ) {
                std::cout << i18n( "Script executed." ).toUtf8().data() << std::endl;
            } else {
                kWarning() << i18n( "Could not execute script." ) ;
            }
        }

        qApp->processEvents();
        map->setupProjector();
        map->exportSkyImage( &sky );
        qApp->processEvents();

        if ( ! sky.save( fname, format ) ) kWarning() << i18n( "Unable to save image: %1 ", fname ) ;
        else kDebug() << i18n( "Saved to file: %1", fname );

        delete map;
        delete dat;
        return 0;
    }

    //start up normally in GUI mode

    //Try to parse the given date string
    QString datestring = args->getOption( "date" );
    //DEBUG
    kDebug() << "Date string: " << datestring;

    if ( ! datestring.isEmpty() && ! KStarsDateTime::fromString( datestring ).isValid() ) {
        kWarning() << i18n( "Using CPU date/time instead." ) ;
        datestring.clear();
    }

    KStars::createInstance( true, ! args->isSet( "paused" ), datestring );
    args->clear();
    QObject::connect(kapp, SIGNAL(lastWindowClosed()), kapp, SLOT(quit()));
    return a.exec();

}