QuickPopupWidget::QuickPopupWidget(QWidget* parent) : PopupWidget(parent), m_view(new DeclarativeView(this)) { setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_ShowWithoutActivating); setAttribute(Qt::WA_X11NetWmWindowTypeToolTip); //transparency setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_TranslucentBackground); m_view->viewport()->setAttribute(Qt::WA_TranslucentBackground); m_view->viewport()->setAutoFillBackground(false); m_view->setResizeMode(DeclarativeView::SizeRootObjectToView); QVBoxLayout *l = new QVBoxLayout(this); l->addWidget(m_view); l->setMargin(0); setLayout(l); connect(m_view, SIGNAL(sceneResized(QSize)), SIGNAL(sizeChanged(QSize))); m_view->rootContext()->setContextProperty(QLatin1String("popup"), this); //TODO optimize! Config cfg("behavior"); cfg.beginGroup("popup"); loadTheme(cfg.value("themeName", "default")); m_timeout.setInterval(cfg.value("timeout", 5000)); cfg.endGroup(); connect(&m_timeout, SIGNAL(timeout()), this, SLOT(timeout())); }
int QDeclarativeViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: setDesignModeBehavior((*reinterpret_cast< bool(*)>(_a[1]))); break; case 1: sceneResized((*reinterpret_cast< QSize(*)>(_a[1]))); break; case 2: { bool _r = open((*reinterpret_cast< const QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 3: openFile(); break; case 4: openUrl(); break; case 5: reload(); break; case 6: takeSnapShot(); break; case 7: toggleRecording(); break; case 8: toggleRecordingWithSelection(); break; case 9: ffmpegFinished((*reinterpret_cast< int(*)>(_a[1]))); break; case 10: showProxySettings(); break; case 11: proxySettingsChanged(); break; case 12: rotateOrientation(); break; case 13: statusChanged(); break; case 14: pauseAnimations(); break; case 15: stepAnimations(); break; case 16: setAnimationStep(); break; case 17: changeAnimationSpeed(); break; case 18: launch((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 19: appAboutToQuit(); break; case 20: autoStartRecording(); break; case 21: autoStopRecording(); break; case 22: recordFrame(); break; case 23: chooseRecordingOptions(); break; case 24: pickRecordingFile(); break; case 25: toggleFullScreen(); break; case 26: changeOrientation((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 27: orientationChanged(); break; case 28: animationSpeedChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 29: showWarnings((*reinterpret_cast< bool(*)>(_a[1]))); break; case 30: warningsWidgetOpened(); break; case 31: warningsWidgetClosed(); break; default: ; } _id -= 32; } return _id; }
MainWindow::MainWindow (QWidget* parent) : QMainWindow(parent) { CAImageProvider::s_imageProvider = new CAImageProvider; qmlRegisterType<CACanvasController> ("CalligraActive", 1, 0, "CanvasController"); qmlRegisterType<CADocumentInfo> ("CalligraActive", 1, 0, "CADocumentInfo"); qmlRegisterType<CADocumentController> ("CalligraActive", 1, 0, "CADocumentController"); qmlRegisterType<CACanvasItem> ("CalligraActive", 1, 0, "CACanvasItem"); qmlRegisterUncreatableType<CAPADocumentModel> ("CalligraActive", 1, 0, "CAPADocumentModel", "Not allowed"); qmlRegisterUncreatableType<CATextDocumentModel> ("CalligraActive", 1, 0, "CATextDocumentModel", "Not allowed"); qmlRegisterInterface<KoCanvasController> ("KoCanvasController"); qmlRegisterUncreatableType<CAAbstractDocumentHandler>("CalligraActive", 1, 0, "CAAbstractDocumentHandler", "Not allowed"); m_view = new QDeclarativeView (this); kdeclarative.setDeclarativeEngine(m_view->engine()); kdeclarative.initialize(); kdeclarative.setupBindings(); QList<QObject*> recentFiles; QList<QObject*> recentTextDocs; QList<QObject*> recentSpreadsheets; QList<QObject*> recentPresentations; QSettings settings; foreach (const QString &string, settings.value ("recentFiles").toStringList()) { CADocumentInfo* docInfo = CADocumentInfo::fromStringList (string.split (QLatin1Char(';'))); recentFiles.append (docInfo); switch (docInfo->type()) { case CADocumentInfo::TextDocument: recentTextDocs.append (docInfo); break; case CADocumentInfo::Spreadsheet: recentSpreadsheets.append (docInfo); break; case CADocumentInfo::Presentation: recentPresentations.append (docInfo); break; default: ; } } foreach (const QString & importPath, KGlobal::dirs()->findDirs ("module", "imports")) { m_view->engine()->addImportPath (importPath); } m_view->rootContext()->setContextProperty("mainwindow", this); m_view->rootContext()->setContextProperty("_calligra_version_string", CALLIGRA_VERSION_STRING); m_view->engine()->addImageProvider(CAImageProvider::identificationString, CAImageProvider::s_imageProvider); m_view->setSource (QUrl::fromLocalFile (CalligraActive::Global::installPrefix() + "/share/calligraactive/qml/Doc.qml")); m_view->setResizeMode (QDeclarativeView::SizeRootObjectToView); connect (m_view, SIGNAL(sceneResized(QSize)), SLOT(adjustWindowSize(QSize))); resize (1024, 768); setCentralWidget (m_view); QTimer::singleShot(0, this, SLOT(checkForAndOpenDocument())); }