Commit e8b40f98 authored by Matthias Möller's avatar Matthias Möller

- add messagebox when paste a copied view for restoring the window size

- fix: keep window size when paste a view, but no view was copied

#refs 375 

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14158 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 8a42cc4b
......@@ -833,14 +833,29 @@ void CoreWidget::delete_garbage() {
void CoreWidget::slotPasteView( ) {
QSize size = examiner_widgets_[PluginFunctions::activeExaminer()]->actionPasteView();
if (size == QSize(0,0))
{
showMaximized();
}
else
if (size.isValid())
{
showNormal();
resizeApplication(size.width(),size.height());
//ask for restoring the window size
QMessageBox msgBox;
msgBox.setText("Restore window size?");
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
if (ret == QMessageBox::Ok)
{
if (size == QSize(0,0))
{
showMaximized();
}
else
{
showNormal();
resizeApplication(size.width(),size.height());
}
}
}
}
......
......@@ -1071,14 +1071,12 @@ bool glViewer::decodeView(const QString& _view, QSize *_windowSize /*= NULL*/)
if ( !ok )
{
std::cerr << "No window size saved!" << std::endl;
w = 0;
}
int h = split[33].toInt(&ok);
if ( !ok )
{
std::cerr << "No window size saved!" << std::endl;
h = 0;
}
*_windowSize = QSize(w,h);
......
......@@ -263,15 +263,15 @@ public:
/** convert current view to text representation
if saved, the old window size will be written into _windowSize
\note QSize(0,0) indicates that the window was maximized or the window size was not saved
\note QSize(0,0) indicates that the window is maximized.
*/
void encodeView(QString& _view, const QSize& _windowSize = QSize());
void encodeView(QString& _view, const QSize& _windowSize = QSize(-1,-1));
/** Decode and apply text representation of view encoded by encodeView().
If \c _view was successfully decoded it will immediately be applied
and \c true is returned, \c false is returned else.
You can save the current Window size via parameter _windowSize
\note QSize(0,0) indicates that the window is maximized.
\note QSize(0,0) indicates that the window was maximized.
*/
bool decodeView(const QString& _view, QSize *_windowSize = NULL);
......@@ -352,7 +352,7 @@ public slots:
const ACG::GLMatrixd& _inverse_modelview );
/** you get the older window size (if saved) back
\note QSize(0,0) indicates that the window was maximized or the window size was not saved
\note QSize(0,0) indicates that the window is maximized.
*/
QSize actionPasteView();
/** if you want to save the windowSize, use the parameter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment