Exemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMdiSubWindow::closeEvent(QCloseEvent* event)
{
    QWidget* mainWidget = widget();

	RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(mainWidget);
    if (!viewWindow)
    {
        RiuViewer* viewer = mainWidget->findChild<RiuViewer*>();
        if (viewer)
        {
            viewWindow = viewer->ownerViewWindow();
        }
    }

    if (viewWindow)
    {
        viewWindow->setMdiWindowGeometry(windowGeometry());
        viewWindow->handleMdiWindowClosed();
        event->accept();
    }
    else
    {
        QMdiSubWindow::closeEvent(event);
    }
}
Exemplo n.º 2
0
QRegion KDecorationPreview::unobscuredRegion( bool active, const QRegion& r ) const
    {
    if( active ) // this one is not obscured
        return r;
    else
        {
        // copied from KWin core's code
        QRegion ret = r;
        QRegion r2 = mask;
        if( r2.isEmpty())
            r2 = QRegion( windowGeometry( true ));
        r2.translate( windowGeometry( true ).x() - windowGeometry( false ).x(),
            windowGeometry( true ).y() - windowGeometry( false ).y());
        ret -= r2;
        return ret;
        }
    }
Exemplo n.º 3
0
WId QxtWindowSystem::windowAt(const QPoint& pos)
{
    Window result = 0;
    WindowList list = windows();
    for (int i = list.size() - 1; i >= 0; --i)
    {
        WId wid = list.at(i);
        if (windowGeometry(wid).contains(pos))
        {
            result = wid;
            break;
        }
    }
    return result;
}
Exemplo n.º 4
0
void MessageBoxImpl::createWindow()
{
	CL_Rect windowGeometry(
			Stage::getWidth() / 2 + MESSAGE_BOX_X_OFFSET,
			Stage::getHeight() / 2 + MESSAGE_BOX_Y_OFFSET,
			CL_Size(
					MESSAGE_BOX_WIDTH,
					MESSAGE_BOX_HEIGHT
			)
	);

	CL_GUITopLevelDescription windowDescription("MessageBox", windowGeometry, false);

	m_window = new CL_Window(m_owner, windowDescription);
	m_window->set_visible(false);

	m_window->func_close().set(this, &MessageBoxImpl::onWindowClose);
}
Exemplo n.º 5
0
void MainWindow::loadConfig()
{
    // Default geometry values
    QRect windowGeometry(50, 50, 700, 400);

    // Load and parse config file if exists
    bool configExists = QFile(this->userFolder + CONFIG_FILE).exists();
    if (configExists)
    {
        QFile file(this->userFolder + CONFIG_FILE);
        if (file.open(QFile::ReadOnly | QIODevice::Text))
        {
            QTextStream in(&file);
            QString data("");
            while (!in.atEnd())
            {
                QString line(in.readLine().trimmed());

                if (line.startsWith("#") || line.isEmpty())
                    continue;

                QStringList parts = line.split("=");
                if (parts.count() != 2)
                    continue;
                QString key = parts.at(0).trimmed().toLower();
                QString value = parts.at(1).trimmed();

                if (key == "serverip")
                    this->serverIp.setAddress(value);
                if (key == "serverport")
                    this->serverPort = value.toInt();
                if (key == "timeoutvalue")
                    this->timeoutValue = value.toInt();
                if (key == "timeoutenabled")
                    this->timeoutEnabled = (value == "1") ? true : false;
                if (key == "windowx")
                    windowGeometry.setX(value.toInt());
                if (key == "windowy")
                    windowGeometry.setY(value.toInt());
                if (key == "windoww")
                    windowGeometry.setWidth(value.toInt());
                if (key == "windowh")
                    windowGeometry.setHeight(value.toInt());
                if (key == "tab1caption")
                    this->tabCaptions[0] = value;
                if (key == "tab2caption")
                    this->tabCaptions[1] = value;
                if (key == "tab3caption")
                    this->tabCaptions[2] = value;
                if (key == "tab4caption")
                    this->tabCaptions[3] = value;
                if (key == "tab5caption")
                    this->tabCaptions[4] = value;
                if (key == "controlsvisible")
                    this->controlsVisible = (value == "1") ? true : false;
                if (key == "layout")
                    this->layoutType = (LayoutType) value.toInt();
            }
            file.close();
        }
    }

    // Load and parse styles file if exists
    bool stylesExists = QFile(this->userFolder + STYLES_FILE).exists();
    if (stylesExists)
    {
        QFile file(this->userFolder + STYLES_FILE);
        if (file.open(QFile::ReadOnly | QIODevice::Text))
        {
            QTextStream in(&file);
            QString data("");
            while (!in.atEnd())
            {
                QString line(in.readLine().trimmed());

                if (line.startsWith("#") || line.isEmpty())
                    continue;

                QStringList parts = line.split("=");
                if (parts.count() != 2)
                    continue;
                QString key = parts.at(0).trimmed().toLower();
                QString value = parts.at(1).trimmed();

                this->styles[key] = value;
            }
            file.close();
        }
    }

    // Apply geometry values
    this->setGeometry(windowGeometry);
}