Skip to content

Commit

Permalink
- Don't make the instantiate/check model dialog modal. This allows op…
Browse files Browse the repository at this point in the history
…ening of multiple dialogs.

- Save the geometry information and restore it the next time user opens the dialog.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19163 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Feb 18, 2014
1 parent 6f38006 commit 4fa340c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
25 changes: 21 additions & 4 deletions OMEdit/OMEditGUI/GUI/Dialogs/ModelicaClassDialog.cpp
Expand Up @@ -876,17 +876,17 @@ void RenameClassDialog::renameClass()
\param pParent - pointer to MainWindow
*/
InformationDialog::InformationDialog(QString windowTitle, QString informationText, bool modelicaTextHighlighter, MainWindow *pMainWindow)
: QDialog(pMainWindow, Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint)
: QDialog(pMainWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint)
{
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle(QString(Helper::applicationName).append(" - ").append(windowTitle));
setModal(true);
mpMainWindow = pMainWindow;
// instantiate the model
QPlainTextEdit *pPlainTextEdit = new QPlainTextEdit(informationText);
if (modelicaTextHighlighter)
{
ModelicaTextHighlighter *pModelicaHighlighter = new ModelicaTextHighlighter(pMainWindow->getOptionsDialog()->getModelicaTextSettings(),
pMainWindow, pPlainTextEdit->document());
ModelicaTextHighlighter *pModelicaHighlighter = new ModelicaTextHighlighter(mpMainWindow->getOptionsDialog()->getModelicaTextSettings(),
mpMainWindow, pPlainTextEdit->document());
Q_UNUSED(pModelicaHighlighter);
}
// Create the button
Expand All @@ -901,6 +901,23 @@ InformationDialog::InformationDialog(QString windowTitle, QString informationTex
mainLayout->addLayout(buttonLayout);
setLayout(mainLayout);
pOkButton->setFocus();
/* restore the window geometry. */
if (mpMainWindow->getOptionsDialog()->getGeneralSettingsPage()->getPreserveUserCustomizations())
{
QSettings settings(QSettings::IniFormat, QSettings::UserScope, Helper::organization, Helper::application);
restoreGeometry(settings.value("InformationDialog/geometry").toByteArray());
}
}

void InformationDialog::closeEvent(QCloseEvent *event)
{
/* save the window geometry. */
if (mpMainWindow->getOptionsDialog()->getGeneralSettingsPage()->getPreserveUserCustomizations())
{
QSettings settings(QSettings::IniFormat, QSettings::UserScope, Helper::organization, Helper::application);
settings.setValue("InformationDialog/geometry", saveGeometry());
}
event->accept();
}

/*!
Expand Down
3 changes: 3 additions & 0 deletions OMEdit/OMEditGUI/GUI/Dialogs/ModelicaClassDialog.h
Expand Up @@ -167,8 +167,11 @@ public slots:
class LibraryTreeNode;
class InformationDialog : public QDialog
{
private:
MainWindow *mpMainWindow;
public:
InformationDialog(QString windowTitle, QString informationText, bool modelicaTextHighlighter = false, MainWindow *pMainWindow = 0);
void closeEvent(QCloseEvent *event);
};

class GraphicsView;
Expand Down

0 comments on commit 4fa340c

Please sign in to comment.