Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
e0e1f800
Commit
e0e1f800
authored
14 years ago
by
Friedemann Kleint
Browse files
Options
Downloads
Patches
Plain Diff
WelcomeMode: Code polishing.
parent
3dc18931
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/utils/welcomemodetreewidget.cpp
+6
-3
6 additions, 3 deletions
src/libs/utils/welcomemodetreewidget.cpp
src/plugins/welcome/communitywelcomepagewidget.cpp
+41
-22
41 additions, 22 deletions
src/plugins/welcome/communitywelcomepagewidget.cpp
with
47 additions
and
25 deletions
src/libs/utils/welcomemodetreewidget.cpp
+
6
−
3
View file @
e0e1f800
...
@@ -106,17 +106,20 @@ QTreeWidgetItem *WelcomeModeTreeWidget::addItem(const QString &label, const QStr
...
@@ -106,17 +106,20 @@ QTreeWidgetItem *WelcomeModeTreeWidget::addItem(const QString &label, const QStr
if
(
!
toolTip
.
isEmpty
())
if
(
!
toolTip
.
isEmpty
())
wdg
->
setToolTip
(
toolTip
);
wdg
->
setToolTip
(
toolTip
);
return
item
;
return
item
;
}
}
void
WelcomeModeTreeWidget
::
slotAddNewsItem
(
const
QString
&
title
,
const
QString
&
description
,
const
QString
&
link
)
void
WelcomeModeTreeWidget
::
slotAddNewsItem
(
const
QString
&
title
,
const
QString
&
description
,
const
QString
&
link
)
{
{
int
itemWidth
=
width
()
-
header
()
->
sectionSize
(
0
);
const
int
itemWidth
=
width
()
-
header
()
->
sectionSize
(
0
);
QFont
f
=
font
();
QFont
f
=
font
();
QString
elidedText
=
QFontMetrics
(
f
).
elidedText
(
description
,
Qt
::
ElideRight
,
itemWidth
);
QString
elidedText
=
QFontMetrics
(
f
).
elidedText
(
description
,
Qt
::
ElideRight
,
itemWidth
);
f
.
setBold
(
true
);
f
.
setBold
(
true
);
QString
elidedTitle
=
QFontMetrics
(
f
).
elidedText
(
title
,
Qt
::
ElideRight
,
itemWidth
);
QString
elidedTitle
=
QFontMetrics
(
f
).
elidedText
(
title
,
Qt
::
ElideRight
,
itemWidth
);
QString
data
=
QString
::
fromLatin1
(
"<b>%1</b><br /><font color='gray'>%2</font>"
).
arg
(
elidedTitle
).
arg
(
elidedText
);
QString
data
=
QLatin1String
(
"<b>"
);
data
+=
elidedTitle
;
data
+=
QLatin1String
(
"</b><br /><font color='gray'>"
);
data
+=
elidedText
;
data
+=
QLatin1String
(
"</font>"
);
addTopLevelItem
(
addItem
(
data
,
link
,
link
));
addTopLevelItem
(
addItem
(
data
,
link
,
link
));
}
}
...
...
This diff is collapsed.
Click to expand it.
src/plugins/welcome/communitywelcomepagewidget.cpp
+
41
−
22
View file @
e0e1f800
...
@@ -37,8 +37,47 @@
...
@@ -37,8 +37,47 @@
#include
<QtGui/QDesktopServices>
#include
<QtGui/QDesktopServices>
#include
<QtGui/QTreeWidgetItem>
#include
<QtGui/QTreeWidgetItem>
struct
Site
{
const
char
*
description
;
const
char
*
url
;
};
static
const
Site
supportSites
[]
=
{
{
QT_TRANSLATE_NOOP
(
"Welcome::Internal::CommunityWelcomePageWidget"
,
"<b>Forum Nokia</b><br /><font color='gray'>Mobile Application Support</font>"
),
"http://www.forum.nokia.com/I_Want_To/Develop_Mobile_Applications/Technical_Support/"
},
{
QT_TRANSLATE_NOOP
(
"Welcome::Internal::CommunityWelcomePageWidget"
,
"<b>Qt GPL Support</b><br /><font color='gray'>Buy professional Qt support</font>"
),
"http://shop.qt.nokia.com/en/support.html"
},
{
QT_TRANSLATE_NOOP
(
"Welcome::Internal::CommunityWelcomePageWidget"
,
"<b>Qt Centre</b><br /><font color='gray'>Community based Qt support</font>"
),
"http://www.qtcentre.org"
}
};
static
const
Site
sites
[]
=
{
{
QT_TRANSLATE_NOOP
(
"Welcome::Internal::CommunityWelcomePageWidget"
,
"<b>Qt Home</b><br /><font color='gray'>Qt by Nokia on the web</font>"
),
"http://qt.nokia.com"
},
{
QT_TRANSLATE_NOOP
(
"Welcome::Internal::CommunityWelcomePageWidget"
,
"<b>Qt Git Hosting</b><br /><font color='gray'>Participate in Qt development</font>"
),
"http://qt.gitorious.org"
},
{
QT_TRANSLATE_NOOP
(
"Welcome::Internal::CommunityWelcomePageWidget"
,
"<b>Qt Apps</b><br /><font color='gray'>Find free Qt-based apps</font>"
),
"http://www.qt-apps.org"
}
};
namespace
Welcome
{
namespace
Welcome
{
namespace
Internal
{
namespace
Internal
{
static
inline
void
populateWelcomeTreeWidget
(
const
Site
*
sites
,
int
count
,
Utils
::
WelcomeModeTreeWidget
*
wt
)
{
for
(
int
s
=
0
;
s
<
count
;
s
++
)
{
const
QString
description
=
CommunityWelcomePageWidget
::
tr
(
sites
[
s
].
description
);
const
QString
url
=
QLatin1String
(
sites
[
s
].
url
);
wt
->
addItem
(
description
,
url
,
url
);
}
}
CommunityWelcomePageWidget
::
CommunityWelcomePageWidget
(
QWidget
*
parent
)
:
CommunityWelcomePageWidget
::
CommunityWelcomePageWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
QWidget
(
parent
),
m_rssFetcher
(
new
RSSFetcher
(
7
)),
m_rssFetcher
(
new
RSSFetcher
(
7
)),
...
@@ -58,28 +97,8 @@ CommunityWelcomePageWidget::CommunityWelcomePageWidget(QWidget *parent) :
...
@@ -58,28 +97,8 @@ CommunityWelcomePageWidget::CommunityWelcomePageWidget(QWidget *parent) :
//: Add localized feed here only if one exists
//: Add localized feed here only if one exists
m_rssFetcher
->
fetch
(
QUrl
(
tr
(
"http://labs.trolltech.com/blogs/feed"
)));
m_rssFetcher
->
fetch
(
QUrl
(
tr
(
"http://labs.trolltech.com/blogs/feed"
)));
QList
<
QPair
<
QString
,
QString
>
>
supportSites
;
populateWelcomeTreeWidget
(
supportSites
,
sizeof
(
supportSites
)
/
sizeof
(
Site
),
ui
->
supportSitesTreeWidget
);
QList
<
QPair
<
QString
,
QString
>
>
sites
;
populateWelcomeTreeWidget
(
sites
,
sizeof
(
sites
)
/
sizeof
(
Site
),
ui
->
miscSitesTreeWidget
);
supportSites
<<
qMakePair
(
tr
(
"<b>Forum Nokia</b><br /><font color='gray'>Mobile Application Support</font>"
),
QString
(
QLatin1String
(
"http://www.forum.nokia.com/I_Want_To/Develop_Mobile_Applications/Technical_Support/"
)));
supportSites
<<
qMakePair
(
tr
(
"<b>Qt GPL Support</b><br /><font color='gray'>Buy professional Qt support</font>"
),
QString
(
QLatin1String
(
"http://shop.qt.nokia.com/en/support.html"
)));
supportSites
<<
qMakePair
(
tr
(
"<b>Qt Centre</b><br /><font color='gray'>Community based Qt support</font>"
),
QString
(
QLatin1String
(
"http://www.qtcentre.org"
)));
sites
<<
qMakePair
(
tr
(
"<b>Qt Home</b><br /><font color='gray'>Qt by Nokia on the web</font>"
),
QString
(
QLatin1String
(
"http://qt.nokia.com"
)));
sites
<<
qMakePair
(
tr
(
"<b>Qt Git Hosting</b><br /><font color='gray'>Participate in Qt development</font>"
),
QString
(
QLatin1String
(
"http://qt.gitorious.org"
)));
sites
<<
qMakePair
(
tr
(
"<b>Qt Apps</b><br /><font color='gray'>Find free Qt-based apps</font>"
),
QString
(
QLatin1String
(
"http://www.qt-apps.org"
)));
QListIterator
<
QPair
<
QString
,
QString
>
>
supportSitesIt
(
supportSites
);
while
(
supportSitesIt
.
hasNext
())
{
QPair
<
QString
,
QString
>
pair
=
supportSitesIt
.
next
();
ui
->
supportSitesTreeWidget
->
addItem
(
pair
.
first
,
pair
.
second
,
pair
.
second
);
}
QListIterator
<
QPair
<
QString
,
QString
>
>
sitesIt
(
sites
);
while
(
sitesIt
.
hasNext
())
{
QPair
<
QString
,
QString
>
pair
=
sitesIt
.
next
();
ui
->
miscSitesTreeWidget
->
addItem
(
pair
.
first
,
pair
.
second
,
pair
.
second
);
}
}
}
CommunityWelcomePageWidget
::~
CommunityWelcomePageWidget
()
CommunityWelcomePageWidget
::~
CommunityWelcomePageWidget
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment