#include "guiapi.h" #include "newp4connectiondialog.h" #include "ui_newp4connectiondialog.h" #include "window.h" GuiApi::GuiApi(MainWindow* mw) { m_MainWindow = mw; setAddressBarVisible(false); m_Framed = true; m_Transparent = false; } void GuiApi::setFramed(bool b) { m_Framed = b; if (b) m_MainWindow->setWindowFlags(m_MainWindow->windowFlags() & ~ Qt::FramelessWindowHint); else m_MainWindow->setWindowFlags(m_MainWindow->windowFlags() | Qt::FramelessWindowHint); m_MainWindow->show(); } void GuiApi::setTransparent(bool b) { QPalette palette = m_MainWindow->ui->webView->palette(); if (b) palette.setBrush(QPalette::Base, Qt::transparent); else palette.setBrush(QPalette::Base, Qt::white); m_MainWindow->ui->webView->page()->setPalette(palette); m_MainWindow->show(); m_MainWindow->repaint(); } void GuiApi::setAddressBarVisible(bool b) { m_MainWindow->ui->actionAddress_Bar->setChecked(!b); m_MainWindow->ui->actionAddress_Bar->trigger(); } void GuiApi::setStatusBarVisible(bool b) { m_MainWindow->ui->actionStatus_Bar->setChecked(!b); m_MainWindow->ui->actionStatus_Bar->trigger(); } void GuiApi::setGeometry(QVariantMap newGeo) { QRect geo = m_MainWindow->geometry(); int x = geo.x(); int y = geo.y(); int w = geo.width(); int h = geo.height(); if (newGeo.contains("x")) x = newGeo.value("x").toInt(); if (newGeo.contains("left")) x = newGeo.value("left").toInt(); if (newGeo.contains("x1")) x = newGeo.value("x1").toInt(); if (newGeo.contains("y")) y = newGeo.value("y").toInt(); if (newGeo.contains("top")) y = newGeo.value("top").toInt(); if (newGeo.contains("y1")) y = newGeo.value("y1").toInt(); if (newGeo.contains("w")) w = newGeo.value("w").toInt(); if (newGeo.contains("right")) w = newGeo.value("right").toInt() - x; if (newGeo.contains("x2")) w = newGeo.value("x2").toInt() - x; if (newGeo.contains("h")) h = newGeo.value("h").toInt(); if (newGeo.contains("bottom")) h = newGeo.value("bottom").toInt() - y; if (newGeo.contains("y2")) h = newGeo.value("y2").toInt() - y; m_MainWindow->setGeometry(QRect(x,y,w,h)); } QVariantMap GuiApi::getGeometry() { QRect geo = m_MainWindow->geometry(); QVariantMap response; response.insert("x",geo.x()); response.insert("y",geo.y()); response.insert("width",geo.width()); response.insert("height",geo.height()); return response; } QVariant GuiApi::promptForConnection(QVariant defaults) { NewP4ConnectionDialog* connectionDialog = new NewP4ConnectionDialog(NULL); connectionDialog->show(); return "cool"; } QObject* GuiApi::openNewWindow() { Window* cw = new Window(); cw->show(); return cw; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 8115 | David George |
a bunch of changes to the GuiApi - probably bound to change, though, so use at your own risk! beginnings of migrating to an "all windows are created equal" model. (as opposed to a MainWindow) removing the unreliable Qt execution of the .js methods - please include in your HTML (<script type="text/javascript" src="qrc:/js/ClientKitMethods.js"></script>) |
||
#1 | 8101 | David George |
beginning of _massive_ re-factoring your current build settings will fail create a new project from newly added .pro file (but change its p4api paths to match your old one) look for updated README as soon as Dave agrees that changes are _indeed_ for the best (Changes by Jaimen) |