QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsbusyindicatordialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsbusyindicatordialog.cpp
3  --------------------------
4  begin : Mar 27, 2013
5  copyright : (C) 2013 by Larry Shaffer
6  email : larrys at dakcarto dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgsbusyindicatordialog.h"
19 
20 #include <QDialog>
21 #include <QLayout>
22 #include <QLabel>
23 #include <QProgressBar>
24 
25 QgsBusyIndicatorDialog::QgsBusyIndicatorDialog( const QString& message, QWidget* parent, Qt::WindowFlags fl )
26  : QDialog( parent, fl ), mMessage( QString( message ) ), mMsgLabel( 0 )
27 {
28  setWindowTitle( tr( "QGIS" ) );
29  setLayout( new QVBoxLayout() );
30  setWindowModality( Qt::WindowModal );
31  setMinimumWidth( 250 );
32  mMsgLabel = new QLabel( mMessage );
33  layout()->addWidget( mMsgLabel );
34 
35  QProgressBar* pb = new QProgressBar();
36  pb->setMaximum( 0 ); // show as busy indicator
37  layout()->addWidget( pb );
38 
39  if ( mMessage.isEmpty() )
40  {
41  mMsgLabel->hide();
42  }
43 }
44 
46 {
47 }
48 
49 void QgsBusyIndicatorDialog::setMessage( const QString& message )
50 {
51  if ( !message.isEmpty() )
52  {
53  mMessage = QString( message );
54  mMsgLabel->setText( mMessage );
55  mMsgLabel->show();
56  }
57 }