Updated the progress dialog when reading parameters (mostly for lags when reading from thr rosparam server)

Added a splash screen for the same reason (parameters are also loaded on startup)

git-svn-id: http://rtabmap.googlecode.com/svn/branches/0.3/rtabmap@90 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2011-06-09 13:57:01 +00:00
parent e367bb8948
commit 9b4cf9cf5f
3 changed files with 45 additions and 44 deletions

View File

@@ -37,6 +37,7 @@ class QGroupBox;
class QMainWindow; class QMainWindow;
class QLineEdit; class QLineEdit;
class QSlider; class QSlider;
class QProgressDialog;
namespace rtabmap { namespace rtabmap {
@@ -155,6 +156,7 @@ private slots:
void updateKpROI(); void updateKpROI();
void changeWorkingDirectory(); void changeWorkingDirectory();
void changeDictionaryPath(); void changeDictionaryPath();
void readSettingsEnd();
protected: protected:
virtual void showEvent ( QShowEvent * event ); virtual void showEvent ( QShowEvent * event );
@@ -175,9 +177,6 @@ protected:
private: private:
bool validateForm(); bool validateForm();
bool validatePanelGeneral();
bool validatePanelFourier();
bool validatePanelSurf();
void setupTreeView(); void setupTreeView();
void setupSignals(); void setupSignals();
void setupPredictionPanel(); void setupPredictionPanel();
@@ -188,6 +187,7 @@ private:
void addParameter(const QObject * object, const QString & value); void addParameter(const QObject * object, const QString & value);
void addParameters(const QGroupBox * box); void addParameters(const QGroupBox * box);
QList<QGroupBox*> getGroupBoxes(); QList<QGroupBox*> getGroupBoxes();
void readSettingsBegin();
protected: protected:
rtabmap::ParametersMap _parameters; rtabmap::ParametersMap _parameters;
@@ -201,6 +201,8 @@ private:
//For Bayes filter prediction parameters //For Bayes filter prediction parameters
QList<QSlider*> _predictionLCSliders; // Sliders used to setup the prediction QList<QSlider*> _predictionLCSliders; // Sliders used to setup the prediction
bool _predictionPanelInitialized; bool _predictionPanelInitialized;
QProgressDialog * _progressDialog;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS(PreferencesDialog::PANEL_FLAGS) Q_DECLARE_OPERATORS_FOR_FLAGS(PreferencesDialog::PANEL_FLAGS)

View File

@@ -49,6 +49,7 @@
#include <QtGui/QDesktopServices> #include <QtGui/QDesktopServices>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QProcess> #include <QtCore/QProcess>
#include <QtGui/QSplashScreen>
#define LOG_FILE_NAME "LogRtabmap.txt" #define LOG_FILE_NAME "LogRtabmap.txt"
#define SHARE_SHOW_LOG_FILE "share/rtabmap/ShowLogs.m" #define SHARE_SHOW_LOG_FILE "share/rtabmap/ShowLogs.m"
@@ -79,6 +80,12 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
initGuiResource(); initGuiResource();
QPixmap pixmap(":images/RTAB-Map.png");
QSplashScreen splash(pixmap);
splash.show();
splash.showMessage(tr("Loading..."));
QApplication::processEvents();
this->setWindowTitle(tr("Constant-Time Appearance-Based Mapping")); this->setWindowTitle(tr("Constant-Time Appearance-Based Mapping"));
this->setWindowIconText(tr("RTAB-Map")); this->setWindowIconText(tr("RTAB-Map"));
@@ -227,6 +234,8 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
this->applyPrefSettings(PreferencesDialog::kPanelAll); this->applyPrefSettings(PreferencesDialog::kPanelAll);
_ui->statsToolBox->setWorkingDirectory(_preferencesDialog->getWorkingDirectory()); _ui->statsToolBox->setWorkingDirectory(_preferencesDialog->getWorkingDirectory());
splash.close();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()

View File

@@ -205,6 +205,10 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_obsoletePanels = kPanelAll; _obsoletePanels = kPanelAll;
_initialized = true; _initialized = true;
_progressDialog = new QProgressDialog(this);
_progressDialog->setWindowTitle(tr("Read parameters..."));
_progressDialog->setMaximum(2);
} }
PreferencesDialog::~PreferencesDialog() { PreferencesDialog::~PreferencesDialog() {
@@ -744,33 +748,7 @@ void PreferencesDialog::writeCoreSettings(const QString & filePath)
bool PreferencesDialog::validateForm() bool PreferencesDialog::validateForm()
{ {
if( validatePanelGeneral() && //TODO...
validatePanelFourier() &&
validatePanelSurf() )
{
return true;
}
return false;
}
bool PreferencesDialog::validatePanelGeneral()
{
/*if(_ui->general_spinBox_hardThr->value() < _ui->general_spinBox_softThr->value())
{
QMessageBox::warning(this, tr("Settings validator"), tr("The hard threshold must be bigger than the soft threshold."));
return false;
}*/
return true;
}
bool PreferencesDialog::validatePanelFourier()
{
return true;
}
bool PreferencesDialog::validatePanelSurf()
{
return true; return true;
} }
@@ -781,19 +759,31 @@ QString PreferencesDialog::getParamMessage()
void PreferencesDialog::showEvent ( QShowEvent * event ) void PreferencesDialog::showEvent ( QShowEvent * event )
{ {
QProgressDialog statusDialog; this->readSettingsBegin();
statusDialog.setWindowTitle(tr("Read parameters...")); }
statusDialog.setLabelText(this->getParamMessage());
statusDialog.setMaximum(2); void PreferencesDialog::readSettingsBegin()
statusDialog.setWindowModality(Qt::WindowModal); {
statusDialog.show(); _progressDialog->setLabelText(this->getParamMessage());
_progressDialog->show();
// this will let the MainThread to display the progress dialog before reading the parameters...
QTimer::singleShot(10, this, SLOT(readSettingsEnd()));
}
void PreferencesDialog::readSettingsEnd()
{
QApplication::processEvents();
this->readSettings(); this->readSettings();
statusDialog.setValue(1);
statusDialog.setLabelText(tr("Reading GUI settings...")); _progressDialog->setValue(1);
_progressDialog->setLabelText(tr("Reading GUI settings..."));
this->setupPredictionPanel(); this->setupPredictionPanel();
this->setupKpRoiPanel(); this->setupKpRoiPanel();
statusDialog.setValue(2);
_progressDialog->setValue(2); // this will make closing...
} }
void PreferencesDialog::saveWindowGeometry(const QString & windowName, const QWidget * window) void PreferencesDialog::saveWindowGeometry(const QString & windowName, const QWidget * window)
@@ -1587,7 +1577,7 @@ void PreferencesDialog::setHardThr(int value)
} }
else else
{ {
this->readSettings(); this->readSettingsBegin();
} }
} }
} }
@@ -1605,7 +1595,7 @@ void PreferencesDialog::setReactivationThr(int value)
} }
else else
{ {
this->readSettings(); this->readSettingsBegin();
} }
} }
} }
@@ -1622,7 +1612,7 @@ void PreferencesDialog::setImgRate(double value)
} }
else else
{ {
this->readSettings(); this->readSettingsBegin();
} }
} }
} }
@@ -1639,7 +1629,7 @@ void PreferencesDialog::setAutoRestart(bool value)
} }
else else
{ {
this->readSettings(); this->readSettingsBegin();
} }
} }
} }
@@ -1656,7 +1646,7 @@ void PreferencesDialog::setTimeLimit(double value)
} }
else else
{ {
this->readSettings(); this->readSettingsBegin();
} }
} }
} }