Skip to content

Commit 21ac796

Browse files
author
timlinux
committed
Added dedicated dialog for the sponsors. No longer parse sponsors from sponsors text file, just edit the html in the dialog directly.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15195 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5bc02cd commit 21ac796

File tree

10 files changed

+362
-214
lines changed

10 files changed

+362
-214
lines changed

images/images.qrc

Lines changed: 121 additions & 120 deletions
Large diffs are not rendered by default.
4.83 KB
Loading

src/app/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ SET(QGIS_APP_SRCS
33
qgisapp.cpp
44
qgisappinterface.cpp
55
qgsabout.cpp
6+
qgssponsors.cpp
67
qgsaddattrdialog.cpp
78
qgsaddjoindialog.cpp
89
qgsannotationwidget.cpp
@@ -143,6 +144,7 @@ SET (QGIS_APP_MOC_HDRS
143144
qgisapp.h
144145
qgisappinterface.h
145146
qgsabout.h
147+
qgssponsors.h
146148
qgsaddattrdialog.h
147149
qgsdisplayangle.h
148150
qgsaddjoindialog.h

src/app/qgisapp.cpp

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,29 +93,33 @@
9393
//
9494
// QGIS Specific Includes
9595
//
96+
9697
#include "qgisapp.h"
9798
#include "qgisappinterface.h"
9899
#include "qgis.h"
99100
#include "qgisplugin.h"
100101
#include "qgsabout.h"
101102
#include "qgsapplication.h"
103+
#include "qgsattributeaction.h"
104+
#include "qgsattributetabledialog.h"
102105
#include "qgsbookmarkitem.h"
103106
#include "qgsbookmarks.h"
104107
#include "qgsclipboard.h"
105108
#include "qgscomposer.h"
106109
#include "qgscomposermanager.h"
107110
#include "qgsconfigureshortcutsdialog.h"
108111
#include "qgscoordinatetransform.h"
112+
#include "qgscredentialdialog.h"
109113
#include "qgscursors.h"
110114
#include "qgscustomprojectiondialog.h"
111115
#include "qgsencodingfiledialog.h"
112116
#include "qgsexception.h"
113117
#include "qgsfeature.h"
114118
#include "qgsformannotationitem.h"
115-
#include "qgslabelinggui.h"
116-
#include "qgsnewvectorlayerdialog.h"
117-
#include "qgshelpviewer.h"
118119
#include "qgsgenericprojectionselector.h"
120+
#include "qgsgpsinformationwidget.h"
121+
#include "qgshelpviewer.h"
122+
#include "qgslabelinggui.h"
119123
#include "qgslegend.h"
120124
#include "qgslegendlayer.h"
121125
#include "qgslogger.h"
@@ -127,6 +131,7 @@
127131
#include "qgsmaptip.h"
128132
#include "qgsmergeattributesdialog.h"
129133
#include "qgsmessageviewer.h"
134+
#include "qgsnewvectorlayerdialog.h"
130135
#include "qgsoptions.h"
131136
#include "qgspastetransformations.h"
132137
#include "qgspluginitem.h"
@@ -136,34 +141,30 @@
136141
#include "qgspluginmetadata.h"
137142
#include "qgspluginregistry.h"
138143
#include "qgspoint.h"
139-
#include "qgsproject.h"
140144
#include "qgsprojectbadlayerguihandler.h"
145+
#include "qgsproject.h"
141146
#include "qgsprojectproperties.h"
142147
#include "qgsproviderregistry.h"
148+
#include "qgsquerybuilder.h"
143149
#include "qgsrastercalcdialog.h"
144150
#include "qgsrasterlayer.h"
145151
#include "qgsrasterlayerproperties.h"
146-
#include "qgsvectorlayerproperties.h"
147152
#include "qgsrectangle.h"
148153
#include "qgsrenderer.h"
149-
#include "qgstextannotationitem.h"
150-
#include "qgswmssourceselect.h"
151154
#include "qgsshortcutsmanager.h"
155+
#include "qgssnappingdialog.h"
156+
#include "qgssponsors.h"
157+
#include "qgstextannotationitem.h"
158+
#include "qgstilescalewidget.h"
152159
#include "qgsundowidget.h"
153160
#include "qgsvectordataprovider.h"
161+
#include "qgsvectorfilewriter.h"
154162
#include "qgsvectorlayer.h"
163+
#include "qgsvectorlayerproperties.h"
164+
#include "qgswmssourceselect.h"
155165
#include "ogr/qgsogrsublayersdialog.h"
156166
#include "ogr/qgsopenvectorlayerdialog.h"
157167
#include "ogr/qgsvectorlayersaveasdialog.h"
158-
#include "qgsattributetabledialog.h"
159-
#include "qgsvectorfilewriter.h"
160-
#include "qgscredentialdialog.h"
161-
#include "qgstilescalewidget.h"
162-
#include "qgsquerybuilder.h"
163-
#include "qgsattributeaction.h"
164-
#include "qgsgpsinformationwidget.h"
165-
#include "qgssnappingdialog.h"
166-
167168
//
168169
// Gdal/Ogr includes
169170
//
@@ -1246,6 +1247,11 @@ void QgisApp::createActions()
12461247
mActionAbout->setMenuRole( QAction::AboutRole ); // put in application menu on Mac OS X
12471248
connect( mActionAbout, SIGNAL( triggered() ), this, SLOT( about() ) );
12481249

1250+
mActionSponsors = new QAction( getThemeIcon( "mActionHelpSponsors.png" ), tr( "QGIS Sponsors!" ), this );
1251+
shortcuts->registerAction( mActionSponsors );
1252+
mActionSponsors->setStatusTip( tr( "QGIS Sponsors" ) );
1253+
connect( mActionSponsors, SIGNAL( triggered() ), this, SLOT( sponsors() ) );
1254+
12491255
mActionMoveLabel = new QAction( getThemeIcon( "mActionMoveLabel.png" ), tr( "Move Label" ), this );
12501256
mActionMoveLabel->setStatusTip( tr( "Move labels interactively" ) );
12511257
connect( mActionMoveLabel, SIGNAL( triggered() ), this, SLOT( moveLabel() ) );
@@ -1662,6 +1668,7 @@ void QgisApp::createMenus()
16621668
mActionHelpSeparator2 = mHelpMenu->addSeparator();
16631669

16641670
mHelpMenu->addAction( mActionAbout );
1671+
mHelpMenu->addAction( mActionSponsors );
16651672
}
16661673

16671674
void QgisApp::createToolBars()
@@ -2087,6 +2094,7 @@ void QgisApp::setTheme( QString theThemeName )
20872094
mActionLocalHistogramStretch->setIcon( getThemeIcon( "/mActionLocalHistogramStretch.png" ) );
20882095
mActionQgisHomePage->setIcon( getThemeIcon( "/mActionQgisHomePage.png" ) );
20892096
mActionAbout->setIcon( getThemeIcon( "/mActionHelpAbout.png" ) );
2097+
mActionSponsors->setIcon( getThemeIcon( "/mActionHelpSponsors.png" ) );
20902098
mActionDraw->setIcon( getThemeIcon( "/mActionDraw.png" ) );
20912099
mActionToggleEditing->setIcon( getThemeIcon( "/mActionToggleEditing.png" ) );
20922100
mActionSaveEdits->setIcon( getThemeIcon( "/mActionSaveEdits.png" ) );
@@ -2611,6 +2619,13 @@ void QgisApp::restoreWindowState()
26112619

26122620
}
26132621
///////////// END OF GUI SETUP ROUTINES ///////////////
2622+
void QgisApp::sponsors()
2623+
{
2624+
QgsSponsors * sponsors = new QgsSponsors();
2625+
sponsors->show();
2626+
sponsors->raise();
2627+
sponsors->activateWindow();
2628+
}
26142629

26152630
void QgisApp::about()
26162631
{

src/app/qgisapp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ class QgisApp : public QMainWindow
327327
QAction *actionCheckQgisVersion() { return mActionCheckQgisVersion; }
328328
QAction *actionHelpSeparator2() { return mActionHelpSeparator2; }
329329
QAction *actionAbout() { return mActionAbout; }
330+
QAction *actionSponsors() { return mActionSponsors; }
330331

331332
//! Menus
332333
QMenu *fileMenu() { return mFileMenu; }
@@ -467,6 +468,8 @@ class QgisApp : public QMainWindow
467468
#endif
468469

469470
private slots:
471+
//! QGis Sponsors
472+
void sponsors();
470473
//! About QGis
471474
void about();
472475
//! Add a raster layer to the map (will prompt user for file name using dlg )
@@ -1016,6 +1019,7 @@ class QgisApp : public QMainWindow
10161019
QAction *mActionCheckQgisVersion;
10171020
QAction *mActionHelpSeparator2;
10181021
QAction *mActionAbout;
1022+
QAction *mActionSponsors;
10191023

10201024
QAction *mActionLocalHistogramStretch;
10211025

src/app/qgsabout.cpp

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -116,58 +116,6 @@ void QgsAbout::init()
116116
}
117117

118118

119-
// read the SPONSORS file and populate the text widget
120-
QFile sponsorFile( QgsApplication::sponsorsFilePath() );
121-
#ifdef QGISDEBUG
122-
printf( "Reading sponsors file %s.............................................\n",
123-
sponsorFile.fileName().toLocal8Bit().constData() );
124-
#endif
125-
if ( sponsorFile.open( QIODevice::ReadOnly ) )
126-
{
127-
QString sponsorHTML = ""
128-
+ tr( "<p>QGIS sponsorship programme:"
129-
"contribute to QGIS development</p>" )
130-
+ "<hr>"
131-
"<table width='100%'>"
132-
"<tr><th>" + tr( "Name" ) + "</th>"
133-
"<th>" + tr( "Website" ) + "</th></tr>";
134-
QString website;
135-
QTextStream sponsorStream( &sponsorFile );
136-
// Always use UTF-8
137-
sponsorStream.setCodec( "UTF-8" );
138-
QString sline;
139-
while ( !sponsorStream.atEnd() )
140-
{
141-
sline = sponsorStream.readLine(); // line of text excluding '\n'
142-
//ignore the line if it starts with a hash....
143-
if ( sline.left( 1 ) == "#" ) continue;
144-
QStringList myTokens = sline.split( "|", QString::SkipEmptyParts );
145-
if ( myTokens.size() == 0 )
146-
{
147-
continue;
148-
}
149-
else if ( myTokens.size() > 1 )
150-
{
151-
website = "<a href=\"" + myTokens[1].remove( ' ' ) + "\">" + myTokens[1] + "</a>";
152-
}
153-
else
154-
{
155-
website = "&nbsp;";
156-
}
157-
sponsorHTML += "<tr>";
158-
sponsorHTML += "<td>" + myTokens[0] + "</td><td>" + website + "</td>";
159-
// close the row
160-
sponsorHTML += "</tr>";
161-
}
162-
sponsorHTML += "</table>";
163-
164-
QString myStyle = QgsApplication::reportStyleSheet();
165-
txtSponsors->clear();
166-
txtSponsors->document()->setDefaultStyleSheet( myStyle );
167-
txtSponsors->setHtml( sponsorHTML );
168-
QgsDebugMsg( QString( "sponsorHTML:%1" ).arg( sponsorHTML.toAscii().constData() ) );
169-
QgsDebugMsg( QString( "txtSponsors:%1" ).arg( txtSponsors->toHtml().toAscii().constData() ) );
170-
}
171119

172120
// read the DONORS file and populate the text widget
173121
QFile donorsFile( QgsApplication::donorsFilePath() );

src/app/qgssponsors.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/***************************************************************************
2+
qgssponsors.cpp - description
3+
-------------------
4+
begin : Sat Aug 10 2002
5+
copyright : (C) 2002 by Gary E.Sherman
6+
email : sherman at mrcc.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+
/* $Id$ */
18+
19+
#include "qgssponsors.h"
20+
#include "qgsapplication.h"
21+
#include <QFile>
22+
#include <QTextStream>
23+
24+
#ifdef Q_OS_MACX
25+
QgsSponsors::QgsSponsors()
26+
: QDialog( NULL, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only
27+
#else
28+
QgsSponsors::QgsSponsors()
29+
: QDialog( NULL ) // Normal dialog in non Mac-OS
30+
#endif
31+
{
32+
setupUi( this );
33+
init();
34+
}
35+
36+
QgsSponsors::~QgsSponsors()
37+
{
38+
}
39+
40+
void QgsSponsors::init()
41+
{
42+
43+
// set the 60x60 icon pixmap
44+
QPixmap icon( QgsApplication::iconsPath() + "qgis-icon-60x60.png" );
45+
qgisIcon->setPixmap( icon );
46+
47+
}

src/app/qgssponsors.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/***************************************************************************
2+
qgssponsors.h - description
3+
-------------------
4+
begin : Sat Aug 10 2002
5+
copyright : (C) 2002 by Gary E.Sherman
6+
email : sherman at mrcc.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+
/* $Id:$ */
18+
#ifndef QGSSPONSORS_H
19+
#define QGSSPONSORS_H
20+
21+
#include "ui_qgssponsorsbase.h"
22+
23+
class QgsSponsors : public QDialog, private Ui::QgsSponsorsBase
24+
{
25+
Q_OBJECT
26+
public:
27+
QgsSponsors();
28+
~QgsSponsors();
29+
30+
private:
31+
void init();
32+
33+
private slots:
34+
};
35+
36+
#endif

src/ui/qgsabout.ui

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
<bool>true</bool>
1818
</property>
1919
<layout class="QGridLayout">
20+
<item row="1" column="0">
21+
<widget class="QDialogButtonBox" name="buttonBox">
22+
<property name="standardButtons">
23+
<set>QDialogButtonBox::Close</set>
24+
</property>
25+
</widget>
26+
</item>
2027
<item row="0" column="0">
2128
<widget class="QTabWidget" name="tabWidget">
2229
<property name="currentIndex">
@@ -38,7 +45,7 @@
3845
</size>
3946
</property>
4047
<property name="pixmap">
41-
<pixmap>:/images/icons/qgis-icon-60x60.png</pixmap>
48+
<pixmap resource="../../images/images.qrc">:/images/icons/qgis-icon-60x60.png</pixmap>
4249
</property>
4350
<property name="scaledContents">
4451
<bool>false</bool>
@@ -222,23 +229,6 @@ p, li { white-space: pre-wrap; }
222229
</item>
223230
</layout>
224231
</widget>
225-
<widget class="QWidget" name="tab_2">
226-
<attribute name="title">
227-
<string>Sponsors</string>
228-
</attribute>
229-
<layout class="QGridLayout">
230-
<item row="0" column="0">
231-
<widget class="QTextBrowser" name="txtSponsors">
232-
<property name="openExternalLinks">
233-
<bool>true</bool>
234-
</property>
235-
<property name="openLinks">
236-
<bool>true</bool>
237-
</property>
238-
</widget>
239-
</item>
240-
</layout>
241-
</widget>
242232
<widget class="QWidget" name="tab_4">
243233
<attribute name="title">
244234
<string>Donors</string>
@@ -258,13 +248,6 @@ p, li { white-space: pre-wrap; }
258248
</widget>
259249
</widget>
260250
</item>
261-
<item row="1" column="0">
262-
<widget class="QDialogButtonBox" name="buttonBox">
263-
<property name="standardButtons">
264-
<set>QDialogButtonBox::Close</set>
265-
</property>
266-
</widget>
267-
</item>
268251
</layout>
269252
</widget>
270253
<layoutdefault spacing="6" margin="11"/>
@@ -274,7 +257,6 @@ p, li { white-space: pre-wrap; }
274257
<tabstop>btnQgisUser</tabstop>
275258
<tabstop>txtProviders</tabstop>
276259
<tabstop>lstDevelopers</tabstop>
277-
<tabstop>txtSponsors</tabstop>
278260
<tabstop>txtTranslators</tabstop>
279261
<tabstop>buttonBox</tabstop>
280262
<tabstop>txtDonors</tabstop>

0 commit comments

Comments
 (0)