1
1
/* **************************************************************************
2
- * Copyright (C) 2007 by Tim Sutton *
3
- * tim@linfiniti.com *
2
+ * Copyright (C) 2007 by Tim Sutton *
3
+ * tim@linfiniti.com *
4
4
* *
5
5
* This program is free software; you can redistribute it and/or modify *
6
6
* it under the terms of the GNU General Public License as published by *
27
27
28
28
QgsTipFactory::QgsTipFactory () : QObject()
29
29
{
30
- // Im just doing this in a simple way so
30
+ // I'm just doing this in a simple way so
31
31
// its easy for translators...later
32
32
// it its worth the time Ill move this data
33
33
// into a sqlite database...
34
34
QgsTip myTip;
35
- myTip.setTitle (tr (" Quantum GIS is open source" ) );
36
- myTip.setContent (tr (" Quantum GIS is open source software."
37
- " This means that the software source code can be freely viewed "
38
- " and modified. The GPL places a restriction that any modifications "
39
- " you make must be made available to the Quantum GIS project, and "
40
- " that you can not create a new version of Quantum GIS under a "
41
- " 'closed source' license. Visit <a href=\" http://qgis.org\" >"
42
- " the QGIS home page (http://qgis.org)</a> for more"
43
- " information." ) );
44
- addGenericTip (myTip);
35
+ myTip.setTitle ( tr ( " Quantum GIS is open source" ) );
36
+ myTip.setContent ( tr ( " Quantum GIS is open source software."
37
+ " This means that the software source code can be freely viewed "
38
+ " and modified. The GPL places a restriction that any modifications "
39
+ " you make must be made available to the Quantum GIS project, and "
40
+ " that you can not create a new version of Quantum GIS under a "
41
+ " 'closed source' license. Visit <a href=\" http://qgis.org\" >"
42
+ " the QGIS home page (http://qgis.org)</a> for more"
43
+ " information." ) );
44
+ addGenericTip ( myTip );
45
45
//
46
- myTip.setTitle (tr (" QGIS Publications" ) );
47
- myTip.setContent (tr (" If you write a scientific paper or any other article"
48
- " that refers to QGIS we would love to include your work"
49
- " in the <a href=\" http://www.qgis.org/en/community/qgis-case-studies.html\" >case studies section</a> of"
50
- " the Quantum GIS home page (http://http://www.qgis.org/en/community/qgis-case-studies.html)."
51
- ) );
52
- addGenericTip (myTip);
53
- myTip.setTitle (tr (" Become an QGIS translator" ) );
54
- myTip.setContent (tr (" Would you like to see QGIS"
55
- " in your native language? We are looking for more translators"
56
- " and would appreciate your help! The translation process is "
57
- " fairly straight forward - instructions are available in the "
58
- " QGIS wiki"
59
- " <a href=\" http://www.qgis.org/wiki/GUI_Translation\" >translator's page (http://www.qgis.org/wiki/GUI_Translation).</a>"
60
- ) );
61
- addGuiTip (myTip);
62
- myTip.setTitle (tr (" QGIS Mailing lists" ) );
63
- myTip.setContent (tr (" If you need help using QGIS"
64
- " we have a 'users' mailing list where users help each other with issues"
65
- " related to using our sofware. We also have a 'developers' mailing list."
66
- " for those wanting help and to discuss things relating the the QGIS code base."
67
- " Details on how to subscribe are in the <a href=\" http://www.qgis.org/en/community/mailing-lists.html\" >community section</a> of"
68
- " the QGIS home page (http://www.qgis.org/en/community/mailing-lists.html)."
69
- ) );
70
- addGuiTip (myTip);
71
- myTip.setTitle (tr (" Is it 'QGIS' or 'Quantum GIS'?" ) );
72
- myTip.setContent (tr (" Both are correct. For articles we suggest you write 'Quantum GIS (QGIS) is ....'"
73
- " and then refer to it as QGIS thereafter."
74
- ) );
75
- addGenericTip (myTip);
76
- myTip.setTitle (tr (" How do I refer to Quantum GIS?" ) );
77
- myTip.setContent (tr (" QGIS is spelled in all caps."
78
- " We have various subprojects of the QGIS project "
79
- " and it will help to avoid confusion if you refer to each by"
80
- " its name:"
81
- " <ul>"
82
- " <li>QGIS Library - this is the C++ library that contains"
83
- " the core logic that is used to build the QGIS user interface and other applications.</li>"
84
- " <li>QGIS Application - this is the desktop application that you know and love so much :-).</li>"
85
- " <li>QGIS Mapserver - this is a server-side application based on the QGIS Library"
86
- " that will serve up your .qgs projects using the WMS protocol.</li>"
87
- " </ul>"
88
- ) );
89
- addGenericTip (myTip);
46
+ myTip.setTitle ( tr ( " QGIS Publications" ) );
47
+ myTip.setContent ( tr ( " If you write a scientific paper or any other article"
48
+ " that refers to QGIS we would love to include your work"
49
+ " in the <a href=\" http://www.qgis.org/en/community/qgis-case-studies.html\" >case studies section</a> of"
50
+ " the Quantum GIS home page (http://http://www.qgis.org/en/community/qgis-case-studies.html)."
51
+ ) );
52
+ addGenericTip ( myTip );
53
+ myTip.setTitle ( tr ( " Become an QGIS translator" ) );
54
+ myTip.setContent ( tr ( " Would you like to see QGIS"
55
+ " in your native language? We are looking for more translators"
56
+ " and would appreciate your help! The translation process is "
57
+ " fairly straight forward - instructions are available in the "
58
+ " QGIS wiki"
59
+ " <a href=\" http://www.qgis.org/wiki/GUI_Translation\" >translator's page (http://www.qgis.org/wiki/GUI_Translation).</a>"
60
+ ) );
61
+ addGuiTip ( myTip );
62
+ myTip.setTitle ( tr ( " QGIS Mailing lists" ) );
63
+ myTip.setContent ( tr ( " If you need help using QGIS"
64
+ " we have a 'users' mailing list where users help each other with issues"
65
+ " related to using our sofware. We also have a 'developers' mailing list."
66
+ " for those wanting help and to discuss things relating the the QGIS code base."
67
+ " Details on how to subscribe are in the <a href=\" http://www.qgis.org/en/community/mailing-lists.html\" >community section</a> of"
68
+ " the QGIS home page (http://www.qgis.org/en/community/mailing-lists.html)."
69
+ ) );
70
+ addGuiTip ( myTip );
71
+ myTip.setTitle ( tr ( " Is it 'QGIS' or 'Quantum GIS'?" ) );
72
+ myTip.setContent ( tr ( " Both are correct. For articles we suggest you write 'Quantum GIS (QGIS) is ....'"
73
+ " and then refer to it as QGIS thereafter."
74
+ ) );
75
+ addGenericTip ( myTip );
76
+ myTip.setTitle ( tr ( " How do I refer to Quantum GIS?" ) );
77
+ myTip.setContent ( tr ( " QGIS is spelled in all caps."
78
+ " We have various subprojects of the QGIS project "
79
+ " and it will help to avoid confusion if you refer to each by"
80
+ " its name:"
81
+ " <ul>"
82
+ " <li>QGIS Library - this is the C++ library that contains"
83
+ " the core logic that is used to build the QGIS user interface and other applications.</li>"
84
+ " <li>QGIS Application - this is the desktop application that you know and love so much :-).</li>"
85
+ " <li>QGIS Mapserver - this is a server-side application based on the QGIS Library"
86
+ " that will serve up your .qgs projects using the WMS protocol.</li>"
87
+ " </ul>"
88
+ ) );
89
+ addGenericTip ( myTip );
90
90
/* Template for adding more tips
91
91
myTip.setTitle(tr(""));
92
92
myTip.setContent(tr(""
@@ -100,48 +100,65 @@ QgsTipFactory::~QgsTipFactory()
100
100
101
101
}
102
102
// private helper method
103
- void QgsTipFactory::addGuiTip (QgsTip theTip)
103
+ void QgsTipFactory::addGuiTip ( QgsTip theTip )
104
104
{
105
105
mGuiTips << theTip;
106
106
mAllTips << theTip;
107
107
}
108
108
// private helper method
109
- void QgsTipFactory::addGenericTip (QgsTip theTip)
109
+ void QgsTipFactory::addGenericTip ( QgsTip theTip )
110
110
{
111
111
mGenericTips << theTip;
112
112
mAllTips << theTip;
113
113
}
114
114
QgsTip QgsTipFactory::getTip ()
115
115
{
116
- srand (QTime::currentTime ().msec ());
116
+ srand ( QTime::currentTime ().msec () );
117
117
int myRand = rand ();
118
- int myValue = static_cast <int > ( myRand % mAllTips .count ()); // range [0,(count-1)]
119
- QgsTip myTip = mAllTips .at (myValue);
118
+ int myValue = static_cast <int >( myRand % mAllTips .count () ); // range [0,(count-1)]
119
+ QgsTip myTip = mAllTips .at ( myValue );
120
120
return myTip;
121
121
}
122
- QgsTip QgsTipFactory::getTip (int thePosition)
122
+ QgsTip QgsTipFactory::getTip ( int thePosition )
123
123
{
124
- QgsTip myTip = mAllTips .at (thePosition);
124
+ QgsTip myTip = mAllTips .at ( thePosition );
125
125
return myTip;
126
126
}
127
127
QgsTip QgsTipFactory::getGenericTip ()
128
128
{
129
- srand (QTime::currentTime ().msec ());
129
+ srand ( QTime::currentTime ().msec () );
130
130
int myRand = rand ();
131
- int myValue = static_cast <int > ( myRand % mGenericTips .count ()); // range [0,(count-1)]
132
- QgsTip myTip = mGenericTips .at (myValue);
131
+ int myValue = static_cast <int >( myRand % mGenericTips .count () ); // range [0,(count-1)]
132
+ QgsTip myTip = mGenericTips .at ( myValue );
133
133
return myTip;
134
134
}
135
135
QgsTip QgsTipFactory::getGuiTip ()
136
136
{
137
- srand (QTime::currentTime ().msec ());
137
+ srand ( QTime::currentTime ().msec () );
138
138
int myRand = rand ();
139
- int myValue = static_cast <int > ( myRand % mGuiTips .count ()); // range [0,(count-1)]
140
- QgsTip myTip = mGuiTips .at (myValue);
139
+ int myValue = static_cast <int >( myRand % mGuiTips .count () ); // range [0,(count-1)]
140
+ QgsTip myTip = mGuiTips .at ( myValue );
141
141
return myTip;
142
142
}
143
- int QgsTipFactory::randomNumber (int theMax)
143
+ int QgsTipFactory::randomNumber ( int theMax )
144
144
{
145
145
return 0 ;
146
146
}
147
147
148
+ int QgsTipFactory::position ( QgsTip tip )
149
+ {
150
+ for ( int i = 0 ; i < mAllTips .count (); ++i )
151
+ {
152
+ QgsTip myTip = mAllTips .at ( i );
153
+ if ( myTip.title () == tip.title () )
154
+ {
155
+ return i;
156
+ }
157
+ }
158
+ return -1 ;
159
+ }
160
+
161
+ int QgsTipFactory::count ()
162
+ {
163
+ return mAllTips .count ();
164
+ }
0 commit comments