Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Indentation fixes
  • Loading branch information
m-kuhn committed Aug 19, 2015
1 parent 10dfb5b commit 772cd0c
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 54 deletions.
3 changes: 3 additions & 0 deletions doc/whatsnew.html
Expand Up @@ -5,6 +5,9 @@
html {
font-family: "Open Sans", "Helvetica Neue", Ubuntu, Arial, sans-serif;
}
body {
font-size: 80%;
}
a {
text-decoration: none;
color: #08c;
Expand Down
18 changes: 9 additions & 9 deletions src/app/qgisapp.cpp
Expand Up @@ -1158,7 +1158,7 @@ void QgisApp::readSettings()



Q_FOREACH( const QString& key, projectKeys )
Q_FOREACH ( const QString& key, projectKeys )
{
QgsWelcomePageItemsModel::RecentProjectData data;
settings.beginGroup( key );
Expand Down Expand Up @@ -2719,7 +2719,7 @@ void QgisApp::updateRecentProjectPaths()
{
mRecentProjectsMenu->clear();

Q_FOREACH( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
{
QAction* action = mRecentProjectsMenu->addAction( QString( "%1 (%2)" ).arg( recentProject.title ).arg( recentProject.path ) );
action->setEnabled( QFile::exists(( recentProject.path ) ) );
Expand All @@ -2745,16 +2745,16 @@ void QgisApp::saveRecentProjectPath( QString projectPath, bool savePreviewImage
if ( savePreviewImage )
{
// Generate a unique file name
QString fileName( QCryptographicHash::hash( ( projectData.path.toUtf8() ), QCryptographicHash::Md5 ).toHex() );
QString fileName( QCryptographicHash::hash(( projectData.path.toUtf8() ), QCryptographicHash::Md5 ).toHex() );
QString previewDir = QString( "%1/previewImages" ).arg( QgsApplication::qgisSettingsDirPath() );
projectData.previewImagePath = QString( "%1/%2.png" ).arg( previewDir ).arg( fileName );
QDir().mkdir( previewDir );

// Render the map canvas
QSize previewSize( 250, 177 ); // h = w / sqrt(2)
QRect previewRect( QPoint( ( mMapCanvas->width() - previewSize.width() ) / 2
, ( mMapCanvas->height() - previewSize.height() ) / 2 )
, previewSize );
QRect previewRect( QPoint(( mMapCanvas->width() - previewSize.width() ) / 2
, ( mMapCanvas->height() - previewSize.height() ) / 2 )
, previewSize );

QPixmap previewImage( previewSize );
QPainter previewPainter( &previewImage );
Expand Down Expand Up @@ -2787,7 +2787,7 @@ void QgisApp::saveRecentProjectPath( QString projectPath, bool savePreviewImage
int idx = 0;

// Persist the list
Q_FOREACH( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
{
++idx;
settings.beginGroup( QString( "/UI/recentProjects/%1" ).arg( idx ) );
Expand Down Expand Up @@ -7754,7 +7754,7 @@ void QgisApp::checkQgisVersion()
QgsVersionInfo* versionInfo = new QgsVersionInfo();
QApplication::setOverrideCursor( Qt::WaitCursor );

connect( versionInfo, SIGNAL(versionInfoAvailable()), this, SLOT(versionReplyFinished()));
connect( versionInfo, SIGNAL( versionInfoAvailable() ), this, SLOT( versionReplyFinished() ) );
versionInfo->checkVersion();
}

Expand All @@ -7765,7 +7765,7 @@ void QgisApp::versionReplyFinished()
QgsVersionInfo* versionInfo = qobject_cast<QgsVersionInfo*>( sender() );
Q_ASSERT( versionInfo );

if( versionInfo->error() == QNetworkReply::NoError )
if ( versionInfo->error() == QNetworkReply::NoError )
{
QString info;

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Expand Up @@ -480,7 +480,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
static LONG WINAPI qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo );
#endif

void parseVersionInfo(QNetworkReply* reply, int& latestVersion, QStringList& versionInfo );
void parseVersionInfo( QNetworkReply* reply, int& latestVersion, QStringList& versionInfo );

public slots:
void layerTreeViewDoubleClicked( const QModelIndex& index );
Expand Down
69 changes: 35 additions & 34 deletions src/app/qgswelcomepage.cpp
Expand Up @@ -26,7 +26,7 @@
#include <QDesktopServices>

QgsWelcomePage::QgsWelcomePage( QWidget* parent )
: QWidget( parent )
: QWidget( parent )
{
QVBoxLayout* mainLayout = new QVBoxLayout;
mainLayout->setMargin( 0 );
Expand All @@ -39,60 +39,61 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )

QWidget* recentProjctsContainer = new QWidget;
recentProjctsContainer->setLayout( new QVBoxLayout );
QLabel* recentProjectsTitle = new QLabel( QString( "<h1>%1</h1>").arg( tr( "Recent Projects" ) ) );
QLabel* recentProjectsTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "Recent Projects" ) ) );
recentProjctsContainer->layout()->addWidget( recentProjectsTitle );

QListView* welcomeScreenListView = new QListView();
mModel = new QgsWelcomePageItemsModel( welcomeScreenListView );
welcomeScreenListView->setModel( mModel );
welcomeScreenListView->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::MinimumExpanding );
welcomeScreenListView->setStyleSheet( "QListView::item {"
" margin-top: 5px;"
" margin-bottom: 5px;"
" margin-left: 15px;"
" margin-right: 15px;"
" border-width: 1px;"
" border-color: #999;"
" border-radius: 9px;"
" background: #eee;"
" padding: 10px;"
"}"
"QListView::item:selected:active {"
" background: #aaaaaa;"
"}");

recentProjctsContainer->layout()->addWidget( welcomeScreenListView );
QListView* recentProjectsListView = new QListView();
mModel = new QgsWelcomePageItemsModel( recentProjectsListView );
recentProjectsListView->setModel( mModel );
recentProjectsListView->setStyleSheet( "QListView::item {"
" margin-top: 5px;"
" margin-bottom: 5px;"
" margin-left: 15px;"
" margin-right: 15px;"
" border-width: 1px;"
" border-color: #999;"
" border-radius: 9px;"
" background: #eee;"
" padding: 10px;"
"}"
"QListView::item:selected:active {"
" background: #aaaaaa;"
"}" );

recentProjctsContainer->layout()->addWidget( recentProjectsListView );

layout->addWidget( recentProjctsContainer );

QWidget* whatsNewContainer = new QWidget;
whatsNewContainer->setLayout( new QVBoxLayout );
QLabel* whatsNewTitle = new QLabel( QString( "<h1>%1</h1>").arg( tr( "QGIS News" ) ) );
QLabel* whatsNewTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "QGIS News" ) ) );
whatsNewContainer->layout()->addWidget( whatsNewTitle );

QgsWebView* whatsNewPage = new QgsWebView();
whatsNewPage->setUrl( QUrl::fromLocalFile( QgsApplication::whatsNewFilePath() ) );
whatsNewPage->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
whatsNewPage->setContextMenuPolicy( Qt::NoContextMenu );
whatsNewPage->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::MinimumExpanding );
whatsNewPage->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );

whatsNewContainer->layout()->addWidget( whatsNewPage );
whatsNewContainer->setMaximumWidth( 250 );
whatsNewContainer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
layout->addWidget( whatsNewContainer );

connect( whatsNewPage, SIGNAL(linkClicked(QUrl)), this, SLOT(whatsNewLinkClicked(QUrl)));
connect( whatsNewPage, SIGNAL( linkClicked( QUrl ) ), this, SLOT( whatsNewLinkClicked( QUrl ) ) );

mVersionInformation = new QLabel;
mainLayout->addWidget( mVersionInformation );
mVersionInformation->setVisible( false );

QgsVersionInfo* versionInfo = new QgsVersionInfo();
connect( versionInfo, SIGNAL(versionInfoAvailable()), this, SLOT(versionInfoReceived()));
connect( versionInfo, SIGNAL( versionInfoAvailable() ), this, SLOT( versionInfoReceived() ) );
versionInfo->checkVersion();

connect( welcomeScreenListView, SIGNAL( doubleClicked( QModelIndex ) ), this, SLOT( itemDoubleClicked( QModelIndex ) ) );
connect( recentProjectsListView, SIGNAL( doubleClicked( QModelIndex ) ), this, SLOT( itemDoubleClicked( QModelIndex ) ) );
}

void QgsWelcomePage::setRecentProjects(const QList<QgsWelcomePageItemsModel::RecentProjectData>& recentProjects)
void QgsWelcomePage::setRecentProjects( const QList<QgsWelcomePageItemsModel::RecentProjectData>& recentProjects )
{
mModel->setRecentProjects( recentProjects );
}
Expand All @@ -110,17 +111,17 @@ void QgsWelcomePage::versionInfoReceived()
if ( versionInfo->newVersionAvailable() )
{
mVersionInformation->setVisible( true );
mVersionInformation->setText( QString( "<b>%1</b>: %2")
mVersionInformation->setText( QString( "<b>%1</b>: %2" )
.arg( tr( "There is a new QGIS version available" ) )
.arg( versionInfo->downloadInfo() ) );
mVersionInformation->setStyleSheet("QLabel{"
" background-color: #dddd00;"
" padding: 5px;"
"}");
mVersionInformation->setStyleSheet( "QLabel{"
" background-color: #dddd00;"
" padding: 5px;"
"}" );
}
}

void QgsWelcomePage::whatsNewLinkClicked(const QUrl& url)
void QgsWelcomePage::whatsNewLinkClicked( const QUrl& url )
{
QDesktopServices::openUrl( url );
}
6 changes: 3 additions & 3 deletions src/app/qgswelcomepage.h
Expand Up @@ -26,14 +26,14 @@ class QgsWelcomePage : public QWidget
Q_OBJECT

public:
QgsWelcomePage(QWidget* parent = 0);
QgsWelcomePage( QWidget* parent = 0 );

void setRecentProjects( const QList<QgsWelcomePageItemsModel::RecentProjectData>& recentProjects );

private slots:
void itemDoubleClicked(const QModelIndex& index );
void itemDoubleClicked( const QModelIndex& index );
void versionInfoReceived();
void whatsNewLinkClicked(const QUrl& url );
void whatsNewLinkClicked( const QUrl& url );

private:
QgsWelcomePageItemsModel* mModel;
Expand Down
13 changes: 7 additions & 6 deletions src/app/qgswelcomepageitemsmodel.h
Expand Up @@ -24,16 +24,17 @@ class QgsWelcomePageItemsModel : public QAbstractListModel
Q_OBJECT

public:
struct RecentProjectData {
bool operator==( const RecentProjectData& other ) { return other.path == this->path; }
QString path;
QString title;
QString previewImagePath;
struct RecentProjectData
{
bool operator==( const RecentProjectData& other ) { return other.path == this->path; }
QString path;
QString title;
QString previewImagePath;
};

QgsWelcomePageItemsModel( QObject* parent = 0 );

void setRecentProjects(const QList<RecentProjectData>& recentProjects );
void setRecentProjects( const QList<RecentProjectData>& recentProjects );

int rowCount( const QModelIndex& parent ) const;
QVariant data( const QModelIndex& index, int role ) const;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.h
Expand Up @@ -82,7 +82,7 @@ class CORE_EXPORT QgsProject : public QObject
/**
Every project has an associated title string
@deprecated Use @link setTitle @endlink instead.
@deprecated Use setTitle instead.
*/
//@{
Q_DECL_DEPRECATED inline void title( const QString & title ) { setTitle( title ); }
Expand Down

0 comments on commit 772cd0c

Please sign in to comment.