int main(int argc, char* argv[]) { PLEAboutData aboutData; aboutData.setAppName("photolayoutseditor"); aboutData.setCatalogName("kipiplugin_photolayoutseditor"); KCmdLineArgs::init(argc,argv,&aboutData); KCmdLineOptions options; options.add("+file", ki18n("Input file")); KCmdLineArgs::addCmdLineOptions(options); KApplication app; aboutData.setProgramLogo(KIcon("photolayoutseditor")); PhotoLayoutsEditor* w = PhotoLayoutsEditor::instance(0); w->setAttribute(Qt::WA_DeleteOnClose, true); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); if (args->count()) { KUrl url = args->url(0); if (url.isValid()) w->open(url); } w->show(); int result = app.exec(); return result; }
bool UndoCommandEventFilter::eventFilter(QObject * watched, QEvent * event) { if (event->type() == UndoCommandEvent::registeredEventType()) { PhotoLayoutsEditor * editor = qobject_cast<PhotoLayoutsEditor*>(watched); if (!editor) return false; //editor->undoCommandEvent(dynamic_cast<UndoCommandEvent*>(event)); return true; } if (event->type() == ProgressEvent::registeredEventType()) { PhotoLayoutsEditor * editor = qobject_cast<PhotoLayoutsEditor*>(watched); if (!editor) return false; editor->progressEvent(dynamic_cast<ProgressEvent*>(event)); return true; } return QObject::eventFilter(watched, event); }
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; }