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

« back to all changes in this revision

Viewing changes to src/plugins/copyright_label/plugingui.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:
13
13
#include "qgscontexthelp.h"
14
14
 
15
15
//qt includes
 
16
#include <QColorDialog>
16
17
 
17
18
//standard includes
18
19
 
19
 
QgsCopyrightLabelPluginGui::QgsCopyrightLabelPluginGui() : QDialog()
 
20
QgsCopyrightLabelPluginGui::QgsCopyrightLabelPluginGui( QWidget* parent, Qt::WFlags fl )
 
21
    : QDialog( parent, fl )
20
22
{
21
 
  setupUi(this);
 
23
  setupUi( this );
22
24
  //programmatically hide orientation selection for now
23
25
  cboOrientation->hide();
24
26
  textLabel15->hide();
25
27
}
26
28
 
27
 
QgsCopyrightLabelPluginGui::QgsCopyrightLabelPluginGui(QWidget* parent, Qt::WFlags fl)
28
 
: QDialog(parent, fl)
29
 
{
30
 
  setupUi(this);
31
 
  //programmatically hide orientation selection for now
32
 
  cboOrientation->hide();
33
 
  textLabel15->hide();
34
 
}  
35
29
QgsCopyrightLabelPluginGui::~QgsCopyrightLabelPluginGui()
36
30
{
37
31
}
38
32
 
39
 
void QgsCopyrightLabelPluginGui::on_pbnOK_clicked()
 
33
void QgsCopyrightLabelPluginGui::on_buttonBox_accepted()
40
34
{
41
35
  //hide the dialog before we send all our signals
42
36
  hide();
43
37
  //close the dialog
44
 
  emit changeFont(txtCopyrightText->currentFont());
45
 
  emit changeLabel(txtCopyrightText->text());
46
 
  emit changeColor(txtCopyrightText->color());
47
 
  emit changePlacement(cboPlacement->currentIndex());
48
 
  emit enableCopyrightLabel(cboxEnabled->isChecked());
49
 
  
50
 
  done(1);
51
 
52
 
void QgsCopyrightLabelPluginGui::on_pbnCancel_clicked()
53
 
{
54
 
 close(1);
55
 
}
56
 
 
57
 
void QgsCopyrightLabelPluginGui::on_pbnHelp_clicked()
58
 
{
59
 
  QgsContextHelp::run(context_id);
60
 
}
61
 
void QgsCopyrightLabelPluginGui::setEnabled(bool theBool)
62
 
{
63
 
  cboxEnabled->setChecked(theBool);
64
 
}
65
 
 
66
 
void QgsCopyrightLabelPluginGui::setText(QString theTextQString)
67
 
{
68
 
  txtCopyrightText->setPlainText(theTextQString);
69
 
}
70
 
 
71
 
void QgsCopyrightLabelPluginGui::setPlacementLabels(QStringList& labels)
 
38
  emit changeFont( txtCopyrightText->currentFont() );
 
39
#if QT_VERSION < 0x040300
 
40
  emit changeLabel( txtCopyrightText->text() );
 
41
#else
 
42
  emit changeLabel( txtCopyrightText->toPlainText() );
 
43
#endif
 
44
  emit changeColor( pbnColorChooser->color() );
 
45
  emit changePlacement( cboPlacement->currentIndex() );
 
46
  emit enableCopyrightLabel( cboxEnabled->isChecked() );
 
47
 
 
48
  accept();
 
49
}
 
50
 
 
51
void QgsCopyrightLabelPluginGui::on_buttonBox_rejected()
 
52
{
 
53
  reject();
 
54
}
 
55
 
 
56
void QgsCopyrightLabelPluginGui::on_pbnColorChooser_clicked()
 
57
{
 
58
  QColor c = QColorDialog::getColor();
 
59
  if ( c.isValid() )
 
60
  {
 
61
    pbnColorChooser->setColor( c );
 
62
    QTextCursor cursor = txtCopyrightText->textCursor();
 
63
    txtCopyrightText->selectAll();
 
64
    txtCopyrightText->setTextColor( c );
 
65
    txtCopyrightText->setTextCursor( cursor );
 
66
  }
 
67
}
 
68
 
 
69
void QgsCopyrightLabelPluginGui::setEnabled( bool theBool )
 
70
{
 
71
  cboxEnabled->setChecked( theBool );
 
72
}
 
73
 
 
74
void QgsCopyrightLabelPluginGui::setText( QString theTextQString )
 
75
{
 
76
  txtCopyrightText->setPlainText( theTextQString );
 
77
}
 
78
 
 
79
void QgsCopyrightLabelPluginGui::setPlacementLabels( QStringList& labels )
72
80
{
73
81
  cboPlacement->clear();
74
 
  cboPlacement->addItems(labels);
75
 
}
76
 
 
77
 
void QgsCopyrightLabelPluginGui::setPlacement(int placementIndex)
78
 
{
79
 
  cboPlacement->setCurrentIndex(placementIndex);
 
82
  cboPlacement->addItems( labels );
 
83
}
 
84
 
 
85
void QgsCopyrightLabelPluginGui::setPlacement( int placementIndex )
 
86
{
 
87
  cboPlacement->setCurrentIndex( placementIndex );
 
88
}
 
89
 
 
90
void QgsCopyrightLabelPluginGui::setColor( QColor color )
 
91
{
 
92
  pbnColorChooser->setColor( color );
 
93
  QTextCursor cursor = txtCopyrightText->textCursor();
 
94
  txtCopyrightText->selectAll();
 
95
  txtCopyrightText->setTextColor( color );
 
96
  txtCopyrightText->setTextCursor( cursor );
80
97
}