MainWindow::MainWindow() : QMainWindow(NULL, "mainwnd", WType_TopLevel | WStyle_Customize | WStyle_Title | WStyle_NormalBorder| WStyle_SysMenu), EventReceiver(LowestPriority) { m_grip = NULL; h_lay = NULL; m_bNoResize = false; SET_WNDPROC("mainwnd"); m_icon = "ICQ"; setIcon(Pict(m_icon.c_str())); setTitle(); #ifdef WIN32 pMain = this; if (IsWindowUnicode(winId())){ oldProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)wndProc); }else{ oldProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)wndProc); } #endif bar = NULL; main = new MainWindowWidget(this); setCentralWidget(main); lay = new QVBoxLayout(main); QStatusBar *status = statusBar(); status->hide(); status->installEventFilter(this); }
MobileVis1MainWindow::MobileVis1MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MobileVis1MainWindow) { ui->setupUi(this); #ifdef Q_WS_MAEMO_5 setAttribute(Qt::WA_Maemo5StackedWindow); #endif #if defined (Q_WS_X11) && !defined (Q_WS_MAEMO5) qDebug() << "Q_WS_X11"; //http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html //http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html ui->ReplayStopButton->setIcon( QIcon::fromTheme ("media-playback-start") ); ui->ReplayPauseButton->setIcon( QIcon::fromTheme ("media-playback-pause") ); ui->ReplayStopButton->setIcon( QIcon::fromTheme ("media-playback-stop") ); ui->DVMicroLeftButton->setIcon( QIcon::fromTheme("media-seek-backward") ); ui->DVLeftButton->setIcon( QIcon::fromTheme("media-skip-backward") ); #endif QStatusBar* sb = statusBar(); if ( sb ) sb->hide(); // grabGesture(Qt::PanGesture); // grabGesture(Qt::PinchGesture); // grabGesture(Qt::SwipeGesture); // swipeGesture = new N900SwipeGesture(this); // connect(swipeGesture,SIGNAL(handleSwipe(N900SwipeGesture::SwipeDirection)), // this,SLOT(swipe(N900SwipeGesture::SwipeDirection))); }
extern "C" NPError NPP_SetWindow(NPP instance, NPWindow* window) { if (!instance) return NPERR_INVALID_INSTANCE_ERROR; QtNPInstance* This = (QtNPInstance*) instance->pdata; extern void qtns_setGeometry(QtNPInstance*, const QRect &, const QRect &); const QRect clipRect(window->clipRect.left, window->clipRect.top, window->clipRect.right - window->clipRect.left, window->clipRect.bottom - window->clipRect.top); if (window) This->geometry = QRect(window->x, window->y, window->width, window->height); // take a shortcut if all that was changed is the geometry if (qobject_cast<QWidget*>(This->qt.object) && window && This->window == (QtNPInstance::Widget)window->window) { qtns_setGeometry(This, This->geometry, clipRect); return NPERR_NO_ERROR; } delete This->qt.object; This->qt.object = 0; extern void qtns_destroy(QtNPInstance *This); qtns_destroy(This); if (!window) { This->window = 0; return NPERR_NO_ERROR; } This->window = (QtNPInstance::Widget)window->window; #ifdef Q_WS_X11 //This->display = ((NPSetWindowCallbackStruct *)window->ws_info)->display; #endif extern void qtns_initialize(QtNPInstance*); qtns_initialize(This); next_pi = This; This->qt.object = qtNPFactory()->createObject(This->mimetype); next_pi = 0; if (!This->qt.object) return NPERR_NO_ERROR; if (!This->htmlID.isEmpty()) This->qt.object->setObjectName(QLatin1String(This->htmlID)); This->filter = new QtSignalForwarder(This); QStatusBar *statusbar = qFindChild<QStatusBar*>(This->qt.object); if (statusbar) { int statusSignal = statusbar->metaObject()->indexOfSignal("messageChanged(QString)"); if (statusSignal != -1) { QMetaObject::connect(statusbar, statusSignal, This->filter, -1); statusbar->hide(); } } const QMetaObject *mo = This->qt.object->metaObject(); for (int p = 0; p < mo->propertyCount(); ++p) { const QMetaProperty property = mo->property(p); QByteArray name(property.name()); QVariant value = This->parameters.value(name.toLower()); if (value.isValid()) property.write(This->qt.object, value); } for (int methodIndex = 0; methodIndex < mo->methodCount(); ++methodIndex) { const QMetaMethod method = mo->method(methodIndex); if (method.methodType() == QMetaMethod::Signal) QMetaObject::connect(This->qt.object, methodIndex, This->filter, methodIndex); } if (This->pendingStream) { This->pendingStream->finish(This->bindable); This->pendingStream = 0; } if (!qobject_cast<QWidget*>(This->qt.object)) return NPERR_NO_ERROR; extern void qtns_embed(QtNPInstance*); qtns_embed(This); QEvent e(QEvent::EmbeddingControl); QApplication::sendEvent(This->qt.widget, &e); if (!This->qt.widget->testAttribute(Qt::WA_PaintOnScreen)) This->qt.widget->setAutoFillBackground(true); This->qt.widget->raise(); qtns_setGeometry(This, This->geometry, clipRect); This->qt.widget->show(); return NPERR_NO_ERROR; }