Skip to content

Commit

Permalink
Added dedicated dialog for the sponsors. No longer parse sponsors fro…
Browse files Browse the repository at this point in the history
…m 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
  • Loading branch information
timlinux committed Feb 18, 2011
1 parent 5bc02cd commit 21ac796
Show file tree
Hide file tree
Showing 10 changed files with 362 additions and 214 deletions.
241 changes: 121 additions & 120 deletions images/images.qrc

Large diffs are not rendered by default.

Binary file added images/themes/default/mActionHelpSponsors.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -3,6 +3,7 @@ SET(QGIS_APP_SRCS
qgisapp.cpp
qgisappinterface.cpp
qgsabout.cpp
qgssponsors.cpp
qgsaddattrdialog.cpp
qgsaddjoindialog.cpp
qgsannotationwidget.cpp
Expand Down Expand Up @@ -143,6 +144,7 @@ SET (QGIS_APP_MOC_HDRS
qgisapp.h
qgisappinterface.h
qgsabout.h
qgssponsors.h
qgsaddattrdialog.h
qgsdisplayangle.h
qgsaddjoindialog.h
Expand Down
47 changes: 31 additions & 16 deletions src/app/qgisapp.cpp
Expand Up @@ -93,29 +93,33 @@
//
// QGIS Specific Includes
//

#include "qgisapp.h"
#include "qgisappinterface.h"
#include "qgis.h"
#include "qgisplugin.h"
#include "qgsabout.h"
#include "qgsapplication.h"
#include "qgsattributeaction.h"
#include "qgsattributetabledialog.h"
#include "qgsbookmarkitem.h"
#include "qgsbookmarks.h"
#include "qgsclipboard.h"
#include "qgscomposer.h"
#include "qgscomposermanager.h"
#include "qgsconfigureshortcutsdialog.h"
#include "qgscoordinatetransform.h"
#include "qgscredentialdialog.h"
#include "qgscursors.h"
#include "qgscustomprojectiondialog.h"
#include "qgsencodingfiledialog.h"
#include "qgsexception.h"
#include "qgsfeature.h"
#include "qgsformannotationitem.h"
#include "qgslabelinggui.h"
#include "qgsnewvectorlayerdialog.h"
#include "qgshelpviewer.h"
#include "qgsgenericprojectionselector.h"
#include "qgsgpsinformationwidget.h"
#include "qgshelpviewer.h"
#include "qgslabelinggui.h"
#include "qgslegend.h"
#include "qgslegendlayer.h"
#include "qgslogger.h"
Expand All @@ -127,6 +131,7 @@
#include "qgsmaptip.h"
#include "qgsmergeattributesdialog.h"
#include "qgsmessageviewer.h"
#include "qgsnewvectorlayerdialog.h"
#include "qgsoptions.h"
#include "qgspastetransformations.h"
#include "qgspluginitem.h"
Expand All @@ -136,34 +141,30 @@
#include "qgspluginmetadata.h"
#include "qgspluginregistry.h"
#include "qgspoint.h"
#include "qgsproject.h"
#include "qgsprojectbadlayerguihandler.h"
#include "qgsproject.h"
#include "qgsprojectproperties.h"
#include "qgsproviderregistry.h"
#include "qgsquerybuilder.h"
#include "qgsrastercalcdialog.h"
#include "qgsrasterlayer.h"
#include "qgsrasterlayerproperties.h"
#include "qgsvectorlayerproperties.h"
#include "qgsrectangle.h"
#include "qgsrenderer.h"
#include "qgstextannotationitem.h"
#include "qgswmssourceselect.h"
#include "qgsshortcutsmanager.h"
#include "qgssnappingdialog.h"
#include "qgssponsors.h"
#include "qgstextannotationitem.h"
#include "qgstilescalewidget.h"
#include "qgsundowidget.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorfilewriter.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayerproperties.h"
#include "qgswmssourceselect.h"
#include "ogr/qgsogrsublayersdialog.h"
#include "ogr/qgsopenvectorlayerdialog.h"
#include "ogr/qgsvectorlayersaveasdialog.h"
#include "qgsattributetabledialog.h"
#include "qgsvectorfilewriter.h"
#include "qgscredentialdialog.h"
#include "qgstilescalewidget.h"
#include "qgsquerybuilder.h"
#include "qgsattributeaction.h"
#include "qgsgpsinformationwidget.h"
#include "qgssnappingdialog.h"

//
// Gdal/Ogr includes
//
Expand Down Expand Up @@ -1246,6 +1247,11 @@ void QgisApp::createActions()
mActionAbout->setMenuRole( QAction::AboutRole ); // put in application menu on Mac OS X
connect( mActionAbout, SIGNAL( triggered() ), this, SLOT( about() ) );

mActionSponsors = new QAction( getThemeIcon( "mActionHelpSponsors.png" ), tr( "QGIS Sponsors!" ), this );
shortcuts->registerAction( mActionSponsors );
mActionSponsors->setStatusTip( tr( "QGIS Sponsors" ) );
connect( mActionSponsors, SIGNAL( triggered() ), this, SLOT( sponsors() ) );

mActionMoveLabel = new QAction( getThemeIcon( "mActionMoveLabel.png" ), tr( "Move Label" ), this );
mActionMoveLabel->setStatusTip( tr( "Move labels interactively" ) );
connect( mActionMoveLabel, SIGNAL( triggered() ), this, SLOT( moveLabel() ) );
Expand Down Expand Up @@ -1662,6 +1668,7 @@ void QgisApp::createMenus()
mActionHelpSeparator2 = mHelpMenu->addSeparator();

mHelpMenu->addAction( mActionAbout );
mHelpMenu->addAction( mActionSponsors );
}

void QgisApp::createToolBars()
Expand Down Expand Up @@ -2087,6 +2094,7 @@ void QgisApp::setTheme( QString theThemeName )
mActionLocalHistogramStretch->setIcon( getThemeIcon( "/mActionLocalHistogramStretch.png" ) );
mActionQgisHomePage->setIcon( getThemeIcon( "/mActionQgisHomePage.png" ) );
mActionAbout->setIcon( getThemeIcon( "/mActionHelpAbout.png" ) );
mActionSponsors->setIcon( getThemeIcon( "/mActionHelpSponsors.png" ) );
mActionDraw->setIcon( getThemeIcon( "/mActionDraw.png" ) );
mActionToggleEditing->setIcon( getThemeIcon( "/mActionToggleEditing.png" ) );
mActionSaveEdits->setIcon( getThemeIcon( "/mActionSaveEdits.png" ) );
Expand Down Expand Up @@ -2611,6 +2619,13 @@ void QgisApp::restoreWindowState()

}
///////////// END OF GUI SETUP ROUTINES ///////////////
void QgisApp::sponsors()
{
QgsSponsors * sponsors = new QgsSponsors();
sponsors->show();
sponsors->raise();
sponsors->activateWindow();
}

void QgisApp::about()
{
Expand Down
4 changes: 4 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -327,6 +327,7 @@ class QgisApp : public QMainWindow
QAction *actionCheckQgisVersion() { return mActionCheckQgisVersion; }
QAction *actionHelpSeparator2() { return mActionHelpSeparator2; }
QAction *actionAbout() { return mActionAbout; }
QAction *actionSponsors() { return mActionSponsors; }

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

private slots:
//! QGis Sponsors
void sponsors();
//! About QGis
void about();
//! Add a raster layer to the map (will prompt user for file name using dlg )
Expand Down Expand Up @@ -1016,6 +1019,7 @@ class QgisApp : public QMainWindow
QAction *mActionCheckQgisVersion;
QAction *mActionHelpSeparator2;
QAction *mActionAbout;
QAction *mActionSponsors;

QAction *mActionLocalHistogramStretch;

Expand Down
52 changes: 0 additions & 52 deletions src/app/qgsabout.cpp
Expand Up @@ -116,58 +116,6 @@ void QgsAbout::init()
}


// read the SPONSORS file and populate the text widget
QFile sponsorFile( QgsApplication::sponsorsFilePath() );
#ifdef QGISDEBUG
printf( "Reading sponsors file %s.............................................\n",
sponsorFile.fileName().toLocal8Bit().constData() );
#endif
if ( sponsorFile.open( QIODevice::ReadOnly ) )
{
QString sponsorHTML = ""
+ tr( "<p>QGIS sponsorship programme:"
"contribute to QGIS development</p>" )
+ "<hr>"
"<table width='100%'>"
"<tr><th>" + tr( "Name" ) + "</th>"
"<th>" + tr( "Website" ) + "</th></tr>";
QString website;
QTextStream sponsorStream( &sponsorFile );
// Always use UTF-8
sponsorStream.setCodec( "UTF-8" );
QString sline;
while ( !sponsorStream.atEnd() )
{
sline = sponsorStream.readLine(); // line of text excluding '\n'
//ignore the line if it starts with a hash....
if ( sline.left( 1 ) == "#" ) continue;
QStringList myTokens = sline.split( "|", QString::SkipEmptyParts );
if ( myTokens.size() == 0 )
{
continue;
}
else if ( myTokens.size() > 1 )
{
website = "<a href=\"" + myTokens[1].remove( ' ' ) + "\">" + myTokens[1] + "</a>";
}
else
{
website = "&nbsp;";
}
sponsorHTML += "<tr>";
sponsorHTML += "<td>" + myTokens[0] + "</td><td>" + website + "</td>";
// close the row
sponsorHTML += "</tr>";
}
sponsorHTML += "</table>";

QString myStyle = QgsApplication::reportStyleSheet();
txtSponsors->clear();
txtSponsors->document()->setDefaultStyleSheet( myStyle );
txtSponsors->setHtml( sponsorHTML );
QgsDebugMsg( QString( "sponsorHTML:%1" ).arg( sponsorHTML.toAscii().constData() ) );
QgsDebugMsg( QString( "txtSponsors:%1" ).arg( txtSponsors->toHtml().toAscii().constData() ) );
}

// read the DONORS file and populate the text widget
QFile donorsFile( QgsApplication::donorsFilePath() );
Expand Down
47 changes: 47 additions & 0 deletions src/app/qgssponsors.cpp
@@ -0,0 +1,47 @@
/***************************************************************************
qgssponsors.cpp - description
-------------------
begin : Sat Aug 10 2002
copyright : (C) 2002 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */

#include "qgssponsors.h"
#include "qgsapplication.h"
#include <QFile>
#include <QTextStream>

#ifdef Q_OS_MACX
QgsSponsors::QgsSponsors()
: QDialog( NULL, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only
#else
QgsSponsors::QgsSponsors()
: QDialog( NULL ) // Normal dialog in non Mac-OS
#endif
{
setupUi( this );
init();
}

QgsSponsors::~QgsSponsors()
{
}

void QgsSponsors::init()
{

// set the 60x60 icon pixmap
QPixmap icon( QgsApplication::iconsPath() + "qgis-icon-60x60.png" );
qgisIcon->setPixmap( icon );

}
36 changes: 36 additions & 0 deletions src/app/qgssponsors.h
@@ -0,0 +1,36 @@
/***************************************************************************
qgssponsors.h - description
-------------------
begin : Sat Aug 10 2002
copyright : (C) 2002 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id:$ */
#ifndef QGSSPONSORS_H
#define QGSSPONSORS_H

#include "ui_qgssponsorsbase.h"

class QgsSponsors : public QDialog, private Ui::QgsSponsorsBase
{
Q_OBJECT
public:
QgsSponsors();
~QgsSponsors();

private:
void init();

private slots:
};

#endif
34 changes: 8 additions & 26 deletions src/ui/qgsabout.ui
Expand Up @@ -17,6 +17,13 @@
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
Expand All @@ -38,7 +45,7 @@
</size>
</property>
<property name="pixmap">
<pixmap>:/images/icons/qgis-icon-60x60.png</pixmap>
<pixmap resource="../../images/images.qrc">:/images/icons/qgis-icon-60x60.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
Expand Down Expand Up @@ -222,23 +229,6 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Sponsors</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QTextBrowser" name="txtSponsors">
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="openLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Donors</string>
Expand All @@ -258,13 +248,6 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
Expand All @@ -274,7 +257,6 @@ p, li { white-space: pre-wrap; }
<tabstop>btnQgisUser</tabstop>
<tabstop>txtProviders</tabstop>
<tabstop>lstDevelopers</tabstop>
<tabstop>txtSponsors</tabstop>
<tabstop>txtTranslators</tabstop>
<tabstop>buttonBox</tabstop>
<tabstop>txtDonors</tabstop>
Expand Down

0 comments on commit 21ac796

Please sign in to comment.