26
26
#include < QDesktopServices>
27
27
28
28
QgsWelcomePage::QgsWelcomePage ( QWidget* parent )
29
- : QWidget( parent )
29
+ : QWidget( parent )
30
30
{
31
31
QVBoxLayout* mainLayout = new QVBoxLayout;
32
32
mainLayout->setMargin ( 0 );
@@ -39,60 +39,61 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )
39
39
40
40
QWidget* recentProjctsContainer = new QWidget;
41
41
recentProjctsContainer->setLayout ( new QVBoxLayout );
42
- QLabel* recentProjectsTitle = new QLabel ( QString ( " <h1>%1</h1>" ).arg ( tr ( " Recent Projects" ) ) );
42
+ QLabel* recentProjectsTitle = new QLabel ( QString ( " <h1>%1</h1>" ).arg ( tr ( " Recent Projects" ) ) );
43
43
recentProjctsContainer->layout ()->addWidget ( recentProjectsTitle );
44
44
45
- QListView* welcomeScreenListView = new QListView ();
46
- mModel = new QgsWelcomePageItemsModel ( welcomeScreenListView );
47
- welcomeScreenListView->setModel ( mModel );
48
- welcomeScreenListView->setSizePolicy (QSizePolicy::Ignored, QSizePolicy::MinimumExpanding );
49
- welcomeScreenListView->setStyleSheet ( " QListView::item {"
50
- " margin-top: 5px;"
51
- " margin-bottom: 5px;"
52
- " margin-left: 15px;"
53
- " margin-right: 15px;"
54
- " border-width: 1px;"
55
- " border-color: #999;"
56
- " border-radius: 9px;"
57
- " background: #eee;"
58
- " padding: 10px;"
59
- " }"
60
- " QListView::item:selected:active {"
61
- " background: #aaaaaa;"
62
- " }" );
63
-
64
- recentProjctsContainer->layout ()->addWidget ( welcomeScreenListView );
45
+ QListView* recentProjectsListView = new QListView ();
46
+ mModel = new QgsWelcomePageItemsModel ( recentProjectsListView );
47
+ recentProjectsListView->setModel ( mModel );
48
+ recentProjectsListView->setStyleSheet ( " QListView::item {"
49
+ " margin-top: 5px;"
50
+ " margin-bottom: 5px;"
51
+ " margin-left: 15px;"
52
+ " margin-right: 15px;"
53
+ " border-width: 1px;"
54
+ " border-color: #999;"
55
+ " border-radius: 9px;"
56
+ " background: #eee;"
57
+ " padding: 10px;"
58
+ " }"
59
+ " QListView::item:selected:active {"
60
+ " background: #aaaaaa;"
61
+ " }" );
62
+
63
+ recentProjctsContainer->layout ()->addWidget ( recentProjectsListView );
65
64
66
65
layout->addWidget ( recentProjctsContainer );
67
66
68
67
QWidget* whatsNewContainer = new QWidget;
69
68
whatsNewContainer->setLayout ( new QVBoxLayout );
70
- QLabel* whatsNewTitle = new QLabel ( QString ( " <h1>%1</h1>" ).arg ( tr ( " QGIS News" ) ) );
69
+ QLabel* whatsNewTitle = new QLabel ( QString ( " <h1>%1</h1>" ).arg ( tr ( " QGIS News" ) ) );
71
70
whatsNewContainer->layout ()->addWidget ( whatsNewTitle );
72
71
73
72
QgsWebView* whatsNewPage = new QgsWebView ();
74
73
whatsNewPage->setUrl ( QUrl::fromLocalFile ( QgsApplication::whatsNewFilePath () ) );
75
74
whatsNewPage->page ()->setLinkDelegationPolicy ( QWebPage::DelegateAllLinks );
76
75
whatsNewPage->setContextMenuPolicy ( Qt::NoContextMenu );
77
- whatsNewPage->setSizePolicy (QSizePolicy::Ignored , QSizePolicy::MinimumExpanding );
76
+ whatsNewPage->setSizePolicy ( QSizePolicy::Fixed , QSizePolicy::Expanding );
78
77
79
78
whatsNewContainer->layout ()->addWidget ( whatsNewPage );
79
+ whatsNewContainer->setMaximumWidth ( 250 );
80
+ whatsNewContainer->setSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Preferred );
80
81
layout->addWidget ( whatsNewContainer );
81
82
82
- connect ( whatsNewPage, SIGNAL (linkClicked (QUrl) ), this , SLOT (whatsNewLinkClicked (QUrl)) );
83
+ connect ( whatsNewPage, SIGNAL ( linkClicked ( QUrl ) ), this , SLOT ( whatsNewLinkClicked ( QUrl ) ) );
83
84
84
85
mVersionInformation = new QLabel;
85
86
mainLayout->addWidget ( mVersionInformation );
86
87
mVersionInformation ->setVisible ( false );
87
88
88
89
QgsVersionInfo* versionInfo = new QgsVersionInfo ();
89
- connect ( versionInfo, SIGNAL (versionInfoAvailable ()), this , SLOT (versionInfoReceived ()) );
90
+ connect ( versionInfo, SIGNAL ( versionInfoAvailable () ), this , SLOT ( versionInfoReceived () ) );
90
91
versionInfo->checkVersion ();
91
92
92
- connect ( welcomeScreenListView , SIGNAL ( doubleClicked ( QModelIndex ) ), this , SLOT ( itemDoubleClicked ( QModelIndex ) ) );
93
+ connect ( recentProjectsListView , SIGNAL ( doubleClicked ( QModelIndex ) ), this , SLOT ( itemDoubleClicked ( QModelIndex ) ) );
93
94
}
94
95
95
- void QgsWelcomePage::setRecentProjects (const QList<QgsWelcomePageItemsModel::RecentProjectData>& recentProjects)
96
+ void QgsWelcomePage::setRecentProjects ( const QList<QgsWelcomePageItemsModel::RecentProjectData>& recentProjects )
96
97
{
97
98
mModel ->setRecentProjects ( recentProjects );
98
99
}
@@ -110,17 +111,17 @@ void QgsWelcomePage::versionInfoReceived()
110
111
if ( versionInfo->newVersionAvailable () )
111
112
{
112
113
mVersionInformation ->setVisible ( true );
113
- mVersionInformation ->setText ( QString ( " <b>%1</b>: %2" )
114
+ mVersionInformation ->setText ( QString ( " <b>%1</b>: %2" )
114
115
.arg ( tr ( " There is a new QGIS version available" ) )
115
116
.arg ( versionInfo->downloadInfo () ) );
116
- mVersionInformation ->setStyleSheet (" QLabel{"
117
- " background-color: #dddd00;"
118
- " padding: 5px;"
119
- " }" );
117
+ mVersionInformation ->setStyleSheet ( " QLabel{"
118
+ " background-color: #dddd00;"
119
+ " padding: 5px;"
120
+ " }" );
120
121
}
121
122
}
122
123
123
- void QgsWelcomePage::whatsNewLinkClicked (const QUrl& url)
124
+ void QgsWelcomePage::whatsNewLinkClicked ( const QUrl& url )
124
125
{
125
126
QDesktopServices::openUrl ( url );
126
127
}
0 commit comments