~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/gui/qgsmessageviewer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
/* $Id$ */
18
18
 
19
19
#include "qgsmessageviewer.h"
20
 
 
21
 
 
22
 
QgsMessageViewer::QgsMessageViewer(QWidget *parent, Qt::WFlags fl)
23
 
: QDialog(parent, fl)
 
20
#include <QSettings>
 
21
 
 
22
QgsMessageViewer::QgsMessageViewer( QWidget *parent, Qt::WFlags fl )
 
23
    : QDialog( parent, fl )
24
24
{
25
 
  setupUi(this);
 
25
  setupUi( this );
 
26
  setAttribute( Qt::WA_DeleteOnClose );
 
27
 
26
28
  // Default state for the checkbox
27
 
  setCheckBoxVisible(false);
28
 
  setCheckBoxState(Qt::Unchecked);
 
29
  setCheckBoxVisible( false );
 
30
  setCheckBoxState( Qt::Unchecked );
 
31
 
 
32
  mCheckBoxQSettingsLabel = "";
29
33
}
30
34
 
31
35
QgsMessageViewer::~QgsMessageViewer()
32
36
{
33
37
}
34
38
 
35
 
void QgsMessageViewer::setMessageAsHtml(const QString& msg)
36
 
{
37
 
  txtMessage->setHtml(msg);
38
 
}
39
 
 
40
 
void QgsMessageViewer::setMessageAsPlainText(const QString& msg)
41
 
{
42
 
  txtMessage->setPlainText(msg);
43
 
}
44
 
 
45
 
void QgsMessageViewer::appendMessage(const QString& msg)
46
 
{
47
 
  txtMessage->append(msg);
48
 
}
49
 
 
50
 
void QgsMessageViewer::setCheckBoxText(const QString& text)
51
 
{
52
 
  checkBox->setText(text);
53
 
}
54
 
 
55
 
void QgsMessageViewer::setCheckBoxVisible(bool visible)
56
 
{
57
 
  checkBox->setVisible(visible);
58
 
}
59
 
 
60
 
void QgsMessageViewer::setCheckBoxState(Qt::CheckState state)
61
 
{
62
 
  checkBox->setCheckState(state);
 
39
void QgsMessageViewer::setMessageAsHtml( const QString& msg )
 
40
{
 
41
  txtMessage->setHtml( msg );
 
42
}
 
43
 
 
44
void QgsMessageViewer::setMessageAsPlainText( const QString& msg )
 
45
{
 
46
  txtMessage->setPlainText( msg );
 
47
}
 
48
 
 
49
void QgsMessageViewer::appendMessage( const QString& msg )
 
50
{
 
51
  txtMessage->append( msg );
 
52
}
 
53
 
 
54
 
 
55
void QgsMessageViewer::setMessage( const QString& message, MessageType msgType )
 
56
{
 
57
  if ( msgType == MessageHtml )
 
58
    setMessageAsHtml( message );
 
59
  else
 
60
    setMessageAsPlainText( message );
 
61
}
 
62
 
 
63
void QgsMessageViewer::showMessage( bool blocking )
 
64
{
 
65
  if ( blocking )
 
66
    exec();
 
67
  else
 
68
    show();
 
69
}
 
70
 
 
71
void QgsMessageViewer::setTitle( const QString& title )
 
72
{
 
73
  setWindowTitle( title );
 
74
}
 
75
 
 
76
void QgsMessageViewer::setCheckBoxText( const QString& text )
 
77
{
 
78
  checkBox->setText( text );
 
79
}
 
80
 
 
81
void QgsMessageViewer::setCheckBoxVisible( bool visible )
 
82
{
 
83
  checkBox->setVisible( visible );
 
84
}
 
85
 
 
86
void QgsMessageViewer::setCheckBoxState( Qt::CheckState state )
 
87
{
 
88
  checkBox->setCheckState( state );
63
89
}
64
90
 
65
91
Qt::CheckState QgsMessageViewer::checkBoxState()
66
92
{
67
93
  return checkBox->checkState();
68
94
}
 
95
 
 
96
void QgsMessageViewer::setCheckBoxQSettingsLabel( QString label )
 
97
{
 
98
  mCheckBoxQSettingsLabel = label;
 
99
}
 
100
 
 
101
 
 
102
void QgsMessageViewer::on_checkBox_toggled( bool toggled )
 
103
{
 
104
  if ( !mCheckBoxQSettingsLabel.isEmpty() )
 
105
  {
 
106
    QSettings settings;
 
107
    if ( checkBox->checkState() == Qt::Checked )
 
108
      settings.setValue( mCheckBoxQSettingsLabel, false );
 
109
    else
 
110
      settings.setValue( mCheckBoxQSettingsLabel, true );
 
111
  }
 
112
}