本文整理汇总了C++中KStarsData::clock方法的典型用法代码示例。如果您正苦于以下问题:C++ KStarsData::clock方法的具体用法?C++ KStarsData::clock怎么用?C++ KStarsData::clock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KStarsData
的用法示例。
在下文中一共展示了KStarsData::clock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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"), "[email protected]", "http://www.30doradus.org");
aboutData.addAuthor(i18n("Jasem Mutlaq"), i18n("Current Maintainer"), "[email protected]", "http://www.indilib.org");
// Active developers
aboutData.addAuthor(i18n("Akarsh Simha"), QString(), "[email protected]", "http://www.ph.utexas.edu/~asimha");
aboutData.addAuthor(i18n("Artem Fedoskin"), i18n("KStars Lite"), "[email protected]");
aboutData.addAuthor(i18n("Robert Lancaster"), i18n("FITSViewer Improvements. KStars OSX Port"), "[email protected]");
// Inactive developers
aboutData.addAuthor(i18n("James Bowlin"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Pablo de Vicente"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Thomas Kabelmann"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Heiko Evermann"),QString(), "[email protected]", "http://www.evermann.de");
aboutData.addAuthor(i18n("Carsten Niehaus"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Mark Hollomon"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Alexey Khudyakov"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Médéric Boquien"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Jérôme Sonrier"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Prakash Mohan"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Victor Cărbune"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Henry de Valence"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Samikshan Bairagya"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Rafał Kułaga"), QString(), "[email protected]");
aboutData.addAuthor(i18n("Rishab Arora"), QString(), "[email protected]");
// 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
//.........这里部分代码省略.........
示例2: main
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(), "[email protected]", "http://www.30doradus.org");
aboutData.addAuthor(ki18n("Jasem Mutlaq"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("James Bowlin"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Pablo de Vicente"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Thomas Kabelmann"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Heiko Evermann"),KLocalizedString(), "[email protected]mann.de", "http://www.evermann.de");
aboutData.addAuthor(ki18n("Carsten Niehaus"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Mark Hollomon"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Alexey Khudyakov"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Médéric Boquien"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Akarsh Simha"), KLocalizedString(), "[email protected]", "http://www.ph.utexas.edu/~asimha");
aboutData.addAuthor(ki18n("Jérôme Sonrier"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Prakash Mohan"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Victor Cărbune"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Henry de Valence"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Samikshan Bairagya"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Rafał Kułaga"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Rishab Arora"), KLocalizedString(), "[email protected]");
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();
//.........这里部分代码省略.........