void ChatWindow::init() { kdebugf(); setWindowRole("kadu-chat"); m_chatWidget = m_injectedFactory->makeInjected<ChatWidgetImpl>(m_chat, this); connect(m_chatWidget, SIGNAL(closeRequested(ChatWidget*)), this, SLOT(close())); if (m_chatWidget && m_chatWidget->chat().details() && m_chatWidget->chat().details()->type()) setWindowRole(m_chatWidget->chat().details()->type()->windowRole()); setAttribute(Qt::WA_DeleteOnClose); m_chatWidget->edit()->setFocus(); m_chatWidget->kaduRestoreGeometry(); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(m_chatWidget); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); configurationUpdated(); updateTitle(); CustomPropertiesVariantWrapper *variantWrapper = new CustomPropertiesVariantWrapper( m_chatWidget->chat().data()->customProperties(), "chat-geometry:WindowGeometry", CustomProperties::Storable); new WindowGeometryManager(variantWrapper, defaultGeometry(), this); connect(m_chatWidget->title(), SIGNAL(titleChanged(ChatWidget*)), this, SLOT(updateTitle())); }
void UIVMLogViewerDialog::loadSettings() { /* Acquire widget: */ const UIVMLogViewerWidget *pWidget = qobject_cast<const UIVMLogViewerWidget*>(widget()); /* Restore window geometry: */ const QRect desktopRect = gpDesktop->availableGeometry(this); int iDefaultWidth = desktopRect.width() / 2; int iDefaultHeight = desktopRect.height() * 3 / 4; /* Try obtain the default width of the current logviewer: */ if (pWidget) { int iWidth = pWidget->defaultLogPageWidth(); if (iWidth != 0) iDefaultWidth = iWidth; } QRect defaultGeometry(0, 0, iDefaultWidth, iDefaultHeight); if (centerWidget()) defaultGeometry.moveCenter(centerWidget()->geometry().center()); /* Load geometry from extradata: */ QRect geometry = gEDataManager->logWindowGeometry(this, defaultGeometry); /* Restore geometry: */ LogRel2(("GUI: UIVMLogViewer: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n", geometry.x(), geometry.y(), geometry.width(), geometry.height())); setDialogGeometry(geometry); }
void UIVisoCreator::loadSettings() { const QRect desktopRect = gpDesktop->availableGeometry(this); int iDefaultWidth = desktopRect.width() / 2; int iDefaultHeight = desktopRect.height() * 3 / 4; QRect defaultGeometry(0, 0, iDefaultWidth, iDefaultHeight); QWidget *pParent = qobject_cast<QWidget*>(parent()); if (pParent) defaultGeometry.moveCenter(pParent->geometry().center()); /* Load geometry from extradata: */ QRect geometry = gEDataManager->visoCreatorDialogGeometry(this, defaultGeometry); setDialogGeometry(geometry); }