Commit 21261b75 authored by Benjamin Long's avatar Benjamin Long

ENH : Added modal/unmodal to the player dialog

When the player is paused, the user can have access to the application.
parent b0e60784
......@@ -42,6 +42,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QFile>
#include <QFileDialog>
#include <QMessageBox>
#include <QMoveEvent>
#include <QTableWidget>
#include <QProgressBar>
#include <QPushButton>
......@@ -77,6 +78,7 @@ public:
int CurrentFile;
QStringList Filenames;
QStringList CurrentEvent;
QRect OldRect;
};
// ----------------------------------------------------------------------------
......@@ -121,7 +123,6 @@ void pqPlayBackEventsDialog::pqImplementation::init(pqPlayBackEventsDialog* dial
{
QObject::connect(commentPlayer, SIGNAL(comment(QString)),
this->Ui.logBrowser, SLOT(append(QString)));
qDebug() << "Comment player : " << commentPlayer;
}
dialog->setMaximumHeight(dialog->minimumSizeHint().height());
......@@ -404,6 +405,11 @@ void pqPlayBackEventsDialog::onStopped()
// ----------------------------------------------------------------------------
void pqPlayBackEventsDialog::updateUi()
{
// Update Moda/Modeless
this->onModal(this->Implementation->TestUtility->playingTest() &&
!(this->Implementation->TestUtility->playingTest() &&
this->Implementation->Dispatcher.isPaused()));
// Update player buttons
this->Implementation->Ui.playPauseButton->setChecked(
this->Implementation->TestUtility->playingTest() &&
......@@ -468,3 +474,37 @@ void pqPlayBackEventsDialog::updateUi()
this->update();
}
// ----------------------------------------------------------------------------
void pqPlayBackEventsDialog::onModal(bool value)
{
// From modal to modeless we don't need to hide() show() the dialog
if (value)
{
this->setAttribute(Qt::WA_WState_Visible, false);
this->setAttribute(Qt::WA_WState_Hidden, true);
}
this->setModal(value);
if (value)
{
this->Implementation->OldRect = this->frameGeometry();
this->setVisible(true);
this->Implementation->OldRect = QRect();
}
this->raise();
}
// ----------------------------------------------------------------------------
void pqPlayBackEventsDialog::moveEvent(QMoveEvent* event)
{
if(this->Implementation->OldRect.isValid())
{
QPoint oldPos = this->Implementation->OldRect.topLeft();
this->Implementation->OldRect = QRect();
this->move(oldPos);
}
else
{
this->Superclass::moveEvent(event);
}
}
......@@ -45,6 +45,7 @@ class QTTESTING_EXPORT pqPlayBackEventsDialog : public QDialog
{
Q_OBJECT
typedef QDialog Superclass;
public:
/**
Creates the dialog and begins translating user input with the supplied translator.
......@@ -63,11 +64,15 @@ private slots:
void onStarted();
void onStarted(const QString&);
void onStopped();
void onModal(bool value);
public slots:
virtual void done(int);
void updateUi();
protected:
virtual void moveEvent(QMoveEvent* event);
private:
void loadFiles(const QStringList& filenames);
void addFile(const QString& filename);
......
......@@ -176,7 +176,7 @@ void pqTestUtility::openPlayerDialog()
this->Dispatcher,
this,
QApplication::activeWindow());
dialog->exec();
dialog->show();
}
//-----------------------------------------------------------------------------
......
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