int main(int argc, char *argv[]) { KAboutData aboutData("photolayoutseditor", 0, ki18n("Photo Layouts Editor"), QString("").toUtf8(), ki18n(""), KAboutData::License_GPL, ki18n(""), ki18n(""), QString("").toUtf8()); KCmdLineArgs::init(argc,argv,&aboutData); KApplication a; PhotoLayoutsEditor * w = PhotoLayoutsEditor::instance(0); w->setAttribute(Qt::WA_DeleteOnClose, true); int height = QApplication::desktop()->height()-500; w->resize(round(height*16.0/9.0),height); QDesktopWidget * d = a.desktop(); w->move(d->rect().center()-w->frameGeometry().center()); w->show(); int result = a.exec(); return result; }
int main ( int argc, char **argv ) { KAboutData about ( "kmilion", 0, ki18n ( "KMilion" ), version, ki18n ( description ), KAboutData::License_GPL, ki18n ( "(C) 2010 Mikołaj Sochacki" ), KLocalizedString(), 0, "*****@*****.**" ); about.addAuthor ( ki18n ( "Mikołaj Sochacki" ), KLocalizedString(), "*****@*****.**" ); KCmdLineArgs::init ( argc, argv, &about ); KCmdLineOptions options; options.add ( "+[URL]", ki18n ( "Document to open" ) ); KCmdLineArgs::addCmdLineOptions ( options ); KApplication app; KMilion *widget = new KMilion; const QRect r = app.desktop()->frameGeometry(); widget->setScreenSize ( r.width(), r.height() ); KCmdLineArgs *args; if ( app.isSessionRestored() ) { RESTORE ( KMilion ); } else { args = KCmdLineArgs::parsedArgs(); widget->show(); } args->clear(); // Tak jest w orginale nie mam pojęcia dlaczego? Szczególnie po co kilka razy show! //see if we are starting with session management // if (app.isSessionRestored()) // { // RESTORE(KMilion); // } // else // { // // no session.. just start up normally // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); // if (args->count() == 0) // { // //kmilion *widget = new kmilion; // widget->show(); // } // else // { // int i = 0; // for (; i < args->count(); i++) // { // //kmilion *widget = new kmilion; // widget->show(); // } // } // args->clear(); // } return app.exec(); }