tabs_05-11-09.patch
src/app/qgsframewidget.cpp (revision 0) | ||
---|---|---|
1 |
#include <QBitmap> |
|
2 |
#include <QCheckBox> |
|
3 |
#include <QDockWidget> |
|
4 |
#include <QLineEdit> |
|
5 |
#include <QMenu> |
|
6 |
#include <QMenuBar> |
|
7 |
#include <QMessageBox> |
|
8 |
#include <QProgressBar> |
|
9 |
#include <QStatusBar> |
|
10 |
#include <QToolButton> |
|
11 | ||
12 |
#include "qgisapp.h" |
|
13 |
#include "qgsapplication.h" |
|
14 |
#include "qgscursors.h" |
|
15 |
#include "qgslegend.h" |
|
16 |
#include "qgsmapcanvas.h" |
|
17 |
#include "qgsmaplayerregistry.h" |
|
18 |
#include "qgsmapoverviewcanvas.h" |
|
19 |
#include "qgsmaptip.h" |
|
20 |
#include "qgsproject.h" |
|
21 | ||
22 |
// map tools |
|
23 |
#include "qgsmaptooladdfeature.h" |
|
24 |
#include "qgsmaptooladdisland.h" |
|
25 |
#include "qgsmaptooladdring.h" |
|
26 |
#include "qgsmaptooladdvertex.h" |
|
27 |
#include "qgsmaptooldeletering.h" |
|
28 |
#include "qgsmaptooldeletepart.h" |
|
29 |
#include "qgsmaptooldeletevertex.h" |
|
30 |
#include "qgsmaptoolidentify.h" |
|
31 |
#include "qgsmaptoolmovefeature.h" |
|
32 |
#include "qgsmaptoolmovevertex.h" |
|
33 |
#include "qgsmaptoolnodetool.h" |
|
34 |
#include "qgsmaptoolpan.h" |
|
35 |
#include "qgsmaptoolselect.h" |
|
36 |
#include "qgsmaptoolsplitfeatures.h" |
|
37 |
#include "qgsmaptoolvertexedit.h" |
|
38 |
#include "qgsmaptoolzoom.h" |
|
39 |
#include "qgsmaptoolsimplify.h" |
|
40 |
#include "qgsmeasuretool.h" |
|
41 | ||
42 |
#include "tabs/qgsdesktabwidget.h" |
|
43 | ||
44 |
#include "qgsframewidget.h" |
|
45 | ||
46 |
QgsFrameWidget::QgsFrameWidget( QgisApp *qgis ) |
|
47 |
: mQgis(qgis) |
|
48 |
{ |
|
49 |
setObjectName( "theFrameWidget" ); |
|
50 | ||
51 |
createStatusBar(); |
|
52 |
createCanvas(); |
|
53 |
createLegend(); |
|
54 |
createOverview(); |
|
55 |
createMapTips(); |
|
56 | ||
57 |
mMapTipsVisible = false; |
|
58 |
mQgisMenuBar = qgis->menuBar(); |
|
59 |
} |
|
60 | ||
61 |
QgsFrameWidget::~QgsFrameWidget() |
|
62 |
{ |
|
63 |
delete mMapOverviewCanvas; |
|
64 |
delete mLegend; |
|
65 |
delete mTools; |
|
66 |
delete mMapCanvas; |
|
67 |
} |
|
68 | ||
69 |
// ------------------------------- public ---------------------------------- // |
|
70 |
void QgsFrameWidget::setupConnections() |
|
71 |
{ |
|
72 |
// connect map layer registry signals to legend |
|
73 |
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), |
|
74 |
mLegend, SLOT( removeLayer( QString ) ) ); |
|
75 |
connect( QgsMapLayerRegistry::instance(), SIGNAL( removedAll() ), |
|
76 |
mLegend, SLOT( removeAll() ) ); |
|
77 |
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), |
|
78 |
mLegend, SLOT( addLayer( QgsMapLayer * ) ) ); |
|
79 |
connect( mLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ), |
|
80 |
mQgis, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer* ) ) ); |
|
81 | ||
82 |
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), |
|
83 |
this, SLOT( layerWasAdded( QgsMapLayer * ) ) ); |
|
84 | ||
85 |
//signal when mouse moved over window ( coords display in status bar ) |
|
86 |
connect( mMapCanvas, SIGNAL( xyCoordinates( const QgsPoint & ) ), this, SLOT( showMouseCoordinate( const QgsPoint & ) ) ); |
|
87 |
connect( mMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ), this, SLOT( showProgress( int, int ) ) ); |
|
88 |
connect( mMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( hasCrsTransformEnabled( bool ) ) ); |
|
89 |
connect( mMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( destinationSrsChanged() ) ); |
|
90 |
connect( mMapCanvas, SIGNAL( extentsChanged() ), this, SLOT( showExtents() ) ); |
|
91 |
connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( showScale( double ) ) ); |
|
92 |
connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( updateMouseCoordinatePrecision() ) ); |
|
93 |
connect( mMapCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ), this, SLOT( mapToolChanged( QgsMapTool * ) ) ); |
|
94 |
connect( mMapCanvas, SIGNAL( selectionChanged( QgsMapLayer * ) ), |
|
95 |
mQgis, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) ); |
|
96 | ||
97 |
connect( mRenderSuppressionCBox, SIGNAL( toggled( bool ) ), mMapCanvas, SLOT( setRenderFlag( bool ) ) ); |
|
98 |
connect( mStopRenderButton, SIGNAL( clicked() ), mQgis, SLOT( stopRendering() ) ); |
|
99 | ||
100 |
connect( QgsProject::instance(), SIGNAL( layerLoaded( int, int ) ), this, SLOT( showProgress( int, int ) ) ); |
|
101 |
} // setupConnections |
|
102 | ||
103 |
void QgsFrameWidget::removeConnections() |
|
104 |
{ |
|
105 |
// disconnect map layer registry signals to legend |
|
106 |
disconnect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), |
|
107 |
mLegend, SLOT( removeLayer( QString ) ) ); |
|
108 |
disconnect( QgsMapLayerRegistry::instance(), SIGNAL( removedAll() ), |
|
109 |
mLegend, SLOT( removeAll() ) ); |
|
110 |
disconnect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), |
|
111 |
mLegend, SLOT( addLayer( QgsMapLayer * ) ) ); |
|
112 |
disconnect( mLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ), |
|
113 |
mQgis, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer* ) ) ); |
|
114 | ||
115 |
disconnect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), |
|
116 |
this, SLOT( layerWasAdded( QgsMapLayer * ) ) ); |
|
117 | ||
118 |
//signal when mouse moved over window ( coords display in status bar ) |
|
119 |
disconnect( mMapCanvas, SIGNAL( xyCoordinates( const QgsPoint & ) ), this, SLOT( showMouseCoordinate( const QgsPoint & ) ) ); |
|
120 |
disconnect( mMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ), this, SLOT( showProgress( int, int ) ) ); |
|
121 |
disconnect( mMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( hasCrsTransformEnabled( bool ) ) ); |
|
122 |
disconnect( mMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( destinationSrsChanged() ) ); |
|
123 |
disconnect( mMapCanvas, SIGNAL( extentsChanged() ), this, SLOT( showExtents() ) ); |
|
124 |
disconnect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( showScale( double ) ) ); |
|
125 |
disconnect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( updateMouseCoordinatePrecision() ) ); |
|
126 |
disconnect( mMapCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ), this, SLOT( mapToolChanged( QgsMapTool * ) ) ); |
|
127 |
disconnect( mMapCanvas, SIGNAL( selectionChanged( QgsMapLayer * ) ), |
|
128 |
mQgis, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) ); |
|
129 | ||
130 |
disconnect( mRenderSuppressionCBox, SIGNAL( toggled( bool ) ), mMapCanvas, SLOT( setRenderFlag( bool ) ) ); |
|
131 |
disconnect( mStopRenderButton, SIGNAL( clicked() ), mQgis, SLOT( stopRendering() ) ); |
|
132 | ||
133 |
disconnect( QgsProject::instance(), SIGNAL( layerLoaded( int, int ) ), this, SLOT( showProgress( int, int ) ) ); |
|
134 |
} // removeConnections |
|
135 | ||
136 |
void QgsFrameWidget::saveState() |
|
137 |
{ |
|
138 |
mQgisState = mQgis->saveState(); |
|
139 |
if (mQgisMenuBar->isVisible()) |
|
140 |
{ |
|
141 |
mQgisMenuBar->close(); |
|
142 |
mQgisMenuBar->setParent(0); |
|
143 |
} |
|
144 |
} |
|
145 | ||
146 |
void QgsFrameWidget::restoreState() |
|
147 |
{ |
|
148 |
QList< QToolBar * > tbs = mQgis->findChildren< QToolBar * >(); |
|
149 |
foreach( QToolBar *tb, tbs) |
|
150 |
tb->hide(); |
|
151 | ||
152 |
if (mQgisMenuBar->isHidden()) |
|
153 |
{ |
|
154 |
mQgis->menuBar()->close(); |
|
155 |
mQgis->menuBar()->setParent(0); |
|
156 |
mQgis->setMenuBar(mQgisMenuBar); |
|
157 |
mQgis->menuBar()->show(); |
|
158 |
} |
|
159 | ||
160 |
mQgis->restoreState(mQgisState); |
|
161 |
} |
|
162 | ||
163 |
// ----------------------------- private slots ----------------------------- // |
|
164 |
void QgsFrameWidget::destinationSrsChanged() |
|
165 |
{ |
|
166 |
// save this information to project |
|
167 |
long srsid = mMapCanvas->mapRenderer()->destinationSrs().srsid(); |
|
168 |
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSID", ( int )srsid ); |
|
169 |
} |
|
170 | ||
171 |
// slot to update the progress bar in the status bar |
|
172 |
void QgsFrameWidget::hasCrsTransformEnabled( bool theFlag ) |
|
173 |
{ |
|
174 |
// save this information to project |
|
175 |
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectionsEnabled", ( theFlag ? 1 : 0 ) ); |
|
176 | ||
177 |
// update icon |
|
178 |
if ( theFlag ) |
|
179 |
{ |
|
180 |
mOnTheFlyProjectionStatusButton->setIcon( |
|
181 |
mQgis->getThemeIcon( "mIconProjectionEnabled.png" ) ); |
|
182 |
} |
|
183 |
else |
|
184 |
{ |
|
185 |
mOnTheFlyProjectionStatusButton->setIcon( |
|
186 |
mQgis->getThemeIcon( "mIconProjectionDisabled.png" ) ); |
|
187 |
} |
|
188 |
} |
|
189 | ||
190 |
void QgsFrameWidget::mapToolChanged( QgsMapTool *tool ) |
|
191 |
{ |
|
192 |
if ( tool ) |
|
193 |
{ |
|
194 |
if ( !tool->isEditTool() ) |
|
195 |
{ |
|
196 |
mQgis->mNonEditMapTool = tool; |
|
197 |
} |
|
198 |
mTools->mCurrentTool = tool; |
|
199 |
} |
|
200 |
} |
|
201 | ||
202 |
void QgsFrameWidget::projectPropertiesProjections() |
|
203 |
{ |
|
204 |
// Driver to display the project props dialog and switch to the |
|
205 |
// projections tab |
|
206 |
mQgis->mShowProjectionTab = true; |
|
207 |
mQgis->projectProperties(); |
|
208 |
} |
|
209 | ||
210 |
void QgsFrameWidget::showProgress( int theProgress, int theTotalSteps ) |
|
211 |
{ |
|
212 |
if ( theProgress == theTotalSteps ) |
|
213 |
{ |
|
214 |
mProgressBar->reset(); |
|
215 |
mProgressBar->hide(); |
|
216 |
} |
|
217 |
else |
|
218 |
{ |
|
219 |
//only call show if not already hidden to reduce flicker |
|
220 |
if ( !mProgressBar->isVisible() ) |
|
221 |
{ |
|
222 |
mProgressBar->show(); |
|
223 |
} |
|
224 |
mProgressBar->setMaximum( theTotalSteps ); |
|
225 |
mProgressBar->setValue( theProgress ); |
|
226 |
} |
|
227 |
} |
|
228 | ||
229 |
void QgsFrameWidget::showMouseCoordinate( const QgsPoint & p ) |
|
230 |
{ |
|
231 |
if ( mMapTipsVisible ) |
|
232 |
{ |
|
233 |
// store the point, we need it for when the maptips timer fires |
|
234 |
mLastMapPosition = p; |
|
235 | ||
236 |
// we use this slot to control the timer for maptips since it is fired each time |
|
237 |
// the mouse moves. |
|
238 |
if ( mMapCanvas->underMouse() ) |
|
239 |
{ |
|
240 |
// Clear the maptip (this is done conditionally) |
|
241 |
mpMaptip->clear( mMapCanvas ); |
|
242 |
// don't start the timer if the mouse is not over the map canvas |
|
243 |
mpMapTipsTimer->start(); |
|
244 |
//QgsDebugMsg("Started maptips timer"); |
|
245 |
} |
|
246 |
} |
|
247 |
if ( mToggleExtentsViewButton->isChecked() ) |
|
248 |
{ |
|
249 |
//we are in show extents mode so no need to do anything |
|
250 |
return; |
|
251 |
} |
|
252 |
else |
|
253 |
{ |
|
254 |
mCoordsLabel->setText( p.toString( mMousePrecisionDecimalPlaces ) ); |
|
255 |
// Set minimum necessary width |
|
256 |
if ( mCoordsLabel->width() > mCoordsLabel->minimumWidth() ) |
|
257 |
{ |
|
258 |
mCoordsLabel->setMinimumWidth( mCoordsLabel->width() ); |
|
259 |
} |
|
260 |
} |
|
261 |
} |
|
262 | ||
263 |
void QgsFrameWidget::showScale( double theScale ) |
|
264 |
{ |
|
265 |
if ( theScale >= 1.0 ) |
|
266 |
mScaleEdit->setText( "1:" + QString::number( theScale, 'f', 0 ) ); |
|
267 |
else if ( theScale > 0.0 ) |
|
268 |
mScaleEdit->setText( QString::number( 1.0 / theScale, 'f', 0 ) + ":1" ); |
|
269 |
else |
|
270 |
mScaleEdit->setText( tr( "Invalid scale" ) ); |
|
271 | ||
272 |
// Set minimum necessary width |
|
273 |
if ( mScaleEdit->width() > mScaleEdit->minimumWidth() ) |
|
274 |
{ |
|
275 |
mScaleEdit->setMinimumWidth( mScaleEdit->width() ); |
|
276 |
} |
|
277 |
} |
|
278 | ||
279 |
void QgsFrameWidget::showExtents() |
|
280 |
{ |
|
281 |
if ( !mToggleExtentsViewButton->isChecked() ) |
|
282 |
{ |
|
283 |
//we are in show coords mode so no need to do anything |
|
284 |
return; |
|
285 |
} |
|
286 |
// update the statusbar with the current extents. |
|
287 |
QgsRectangle myExtents = mMapCanvas->extent(); |
|
288 |
mCoordsLabel->setText( tr( "Extents: %1" ).arg( myExtents.toString( true ) ) ); |
|
289 |
//ensure the label is big enough |
|
290 |
if ( mCoordsLabel->width() > mCoordsLabel->minimumWidth() ) |
|
291 |
{ |
|
292 |
mCoordsLabel->setMinimumWidth( mCoordsLabel->width() ); |
|
293 |
} |
|
294 |
} |
|
295 | ||
296 |
void QgsFrameWidget::showMapTip() |
|
297 |
{ |
|
298 |
/* Show the maptip using tooltip */ |
|
299 |
// Stop the timer while we look for a maptip |
|
300 |
mpMapTipsTimer->stop(); |
|
301 | ||
302 |
// Only show tooltip if the mouse is over the canvas |
|
303 |
if ( mMapCanvas->underMouse() ) |
|
304 |
{ |
|
305 |
QPoint myPointerPos = mMapCanvas->mouseLastXY(); |
|
306 | ||
307 |
// Make sure there is an active layer before proceeding |
|
308 | ||
309 |
QgsMapLayer* mypLayer = mMapCanvas->currentLayer(); |
|
310 |
if ( mypLayer ) |
|
311 |
{ |
|
312 |
//QgsDebugMsg("Current layer for maptip display is: " + mypLayer->source()); |
|
313 |
// only process vector layers |
|
314 |
if ( mypLayer->type() == QgsMapLayer::VectorLayer ) |
|
315 |
{ |
|
316 |
// Show the maptip if the maptips button is depressed |
|
317 |
if ( mMapTipsVisible ) |
|
318 |
{ |
|
319 |
mpMaptip->showMapTip( mypLayer, mLastMapPosition, myPointerPos, mMapCanvas ); |
|
320 |
} |
|
321 |
} |
|
322 |
} |
|
323 |
else |
|
324 |
{ |
|
325 |
mStatusBar->showMessage( tr( "Maptips require an active layer" ) ); |
|
326 |
} |
|
327 |
} |
|
328 |
} |
|
329 | ||
330 |
void QgsFrameWidget::extentsViewToggled( bool theFlag ) |
|
331 |
{ |
|
332 |
if ( theFlag ) |
|
333 |
{ |
|
334 |
//extents view mode! |
|
335 |
mToggleExtentsViewButton->setIcon( mQgis->getThemeIcon( "extents.png" ) ); |
|
336 |
mCoordsLabel->setToolTip( tr( "Map coordinates for the current view extents" ) ); |
|
337 |
showExtents(); |
|
338 |
} |
|
339 |
else |
|
340 |
{ |
|
341 |
//mouse cursor pos view mode! |
|
342 |
mToggleExtentsViewButton->setIcon( mQgis->getThemeIcon( "tracking.png" ) ); |
|
343 |
mCoordsLabel->setToolTip( tr( "Map coordinates at mouse cursor position" ) ); |
|
344 |
} |
|
345 |
} |
|
346 | ||
347 |
void QgsFrameWidget::updateMouseCoordinatePrecision() |
|
348 |
{ |
|
349 |
// Work out what mouse display precision to use. This only needs to |
|
350 |
// be when the settings change or the zoom level changes. This |
|
351 |
// function needs to be called every time one of the above happens. |
|
352 | ||
353 |
// Get the display precision from the project settings |
|
354 |
bool automatic = QgsProject::instance()->readBoolEntry( "PositionPrecision", "/Automatic" ); |
|
355 |
int dp = 0; |
|
356 | ||
357 |
if ( automatic ) |
|
358 |
{ |
|
359 |
// Work out a suitable number of decimal places for the mouse |
|
360 |
// coordinates with the aim of always having enough decimal places |
|
361 |
// to show the difference in position between adjacent pixels. |
|
362 |
// Also avoid taking the log of 0. |
|
363 |
if ( mMapCanvas->mapUnitsPerPixel() != 0.0 ) |
|
364 |
dp = static_cast<int>( ceil( -1.0 * log10( mMapCanvas->mapUnitsPerPixel() ) ) ); |
|
365 |
} |
|
366 |
else |
|
367 |
dp = QgsProject::instance()->readNumEntry( "PositionPrecision", "/DecimalPlaces" ); |
|
368 | ||
369 |
// Keep dp sensible |
|
370 |
if ( dp < 0 ) dp = 0; |
|
371 | ||
372 |
mMousePrecisionDecimalPlaces = dp; |
|
373 |
} |
|
374 | ||
375 |
void QgsFrameWidget::userScale() |
|
376 |
{ |
|
377 |
double currentScale = mMapCanvas->scale(); |
|
378 | ||
379 |
QStringList parts = mScaleEdit->text().split( ':' ); |
|
380 |
if ( parts.size() == 2 ) |
|
381 |
{ |
|
382 |
bool leftOk, rightOk; |
|
383 |
double leftSide = parts.at( 0 ).toDouble( &leftOk ); |
|
384 |
double rightSide = parts.at( 1 ).toDouble( &rightOk ); |
|
385 |
if ( leftSide > 0.0 && leftOk && rightOk ) |
|
386 |
{ |
|
387 |
double wantedScale = rightSide / leftSide; |
|
388 |
mMapCanvas->zoomByFactor( wantedScale / currentScale ); |
|
389 |
} |
|
390 |
} |
|
391 |
} |
|
392 | ||
393 |
void QgsFrameWidget::userCenter() |
|
394 |
{ |
|
395 |
QStringList parts = mCoordsEdit->text().split( ',' ); |
|
396 |
if ( parts.size() != 2 ) |
|
397 |
return; |
|
398 | ||
399 |
bool xOk; |
|
400 |
double x = parts.at( 0 ).toDouble( &xOk ); |
|
401 |
if ( !xOk ) |
|
402 |
return; |
|
403 | ||
404 |
bool yOk; |
|
405 |
double y = parts.at( 1 ).toDouble( &yOk ); |
|
406 |
if ( !yOk ) |
|
407 |
return; |
|
408 | ||
409 |
QgsRectangle r = mMapCanvas->extent(); |
|
410 | ||
411 |
mMapCanvas->setExtent( |
|
412 |
QgsRectangle( |
|
413 |
x - r.width() / 2.0, y - r.height() / 2.0, |
|
414 |
x + r.width() / 2.0, y + r.height() / 2.0 |
|
415 |
) |
|
416 |
); |
|
417 |
mMapCanvas->refresh(); |
|
418 |
} |
|
419 | ||
420 |
void QgsFrameWidget::layerWasAdded( QgsMapLayer *layer ) |
|
421 |
{ |
|
422 |
if ( layer->type() == QgsMapLayer::RasterLayer ) |
|
423 |
{ |
|
424 |
QObject::connect( layer, |
|
425 |
SIGNAL( drawingProgress( int, int ) ), |
|
426 |
this, |
|
427 |
SLOT( showProgress( int, int ) ) ); |
|
428 |
// connect up any request the raster may make to update the statusbar message |
|
429 |
QObject::connect( layer, |
|
430 |
SIGNAL( statusChanged( QString ) ), |
|
431 |
mStatusBar, |
|
432 |
SLOT( showMessage( QString ) ) ); |
|
433 |
} |
|
434 |
} |
|
435 | ||
436 |
// ------------------------------- private --------------------------------- // |
|
437 |
void QgsFrameWidget::createCanvas() |
|
438 |
{ |
|
439 |
// create map canvas and tools |
|
440 |
mMapCanvas = new QgsMapCanvas( this ); |
|
441 |
mTools = new QgisApp::Tools(); |
|
442 | ||
443 |
setToolsForMapCanvas( mMapCanvas, mTools ); |
|
444 |
mMapCanvas->setObjectName( "theMapCanvas" ); |
|
445 | ||
446 |
// set canvas color in map canvas |
|
447 |
int redInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorRedPart", 255 ); |
|
448 |
int greenInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorGreenPart", 255 ); |
|
449 |
int blueInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorBluePart", 255 ); |
|
450 |
QColor color = QColor( redInt, greenInt, blueInt ); |
|
451 |
mMapCanvas->setCanvasColor( color ); // this is fill colour before rendering onto canvas |
|
452 | ||
453 |
// set initial extent for map canvas |
|
454 |
QRect tabRect = mQgis->deskTabWidget()->rect(); |
|
455 |
QgsRectangle initExtent(tabRect.x(), tabRect.y(), tabRect.width(), tabRect.height()); |
|
456 |
mMapCanvas->setExtent(initExtent); |
|
457 |
} |
|
458 | ||
459 |
void QgsFrameWidget::createLegend() |
|
460 |
{ |
|
461 |
// create map legend for map canvas |
|
462 |
mLegend = new QgsLegend( NULL, "theMapLegend" ); |
|
463 |
mLegend->setObjectName( "theMapLegend" ); |
|
464 |
mLegend->setMapCanvas( mMapCanvas ); |
|
465 | ||
466 |
// add the toggle editing action also to legend such that right click menu and button show the same state |
|
467 |
mLegend->setToggleEditingAction( mQgis->actionToggleEditing() ); |
|
468 |
mLegend->setWhatsThis( tr( "Map legend that displays all the layers currently on the map canvas." |
|
469 |
"Click on the check box to turn a layer on or off. Double click on a layer" |
|
470 |
"in the legend to customize its appearance and set other properties." ) ); |
|
471 |
} |
|
472 | ||
473 |
void QgsFrameWidget::createOverview() |
|
474 |
{ |
|
475 |
// create overview canvas |
|
476 |
mMapOverviewCanvas = new QgsMapOverviewCanvas( NULL, mMapCanvas ); |
|
477 |
mMapOverviewCanvas->setWhatsThis( tr( "Map overview canvas. This canvas can be used to display a locator map" |
|
478 |
"that shows the current extent of the map canvas. The current extent is shown as" |
|
479 |
"a red rectangle. Any layer on the map can be added to the overview canvas." ) ); |
|
480 | ||
481 |
QBitmap overviewPanBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits ); |
|
482 |
QBitmap overviewPanBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits ); |
|
483 |
//set upper left corner as hot spot - this is better when extent marker is small; hand won't cover the marker |
|
484 |
mQgis->mOverviewMapCursor = new QCursor( overviewPanBmp, overviewPanBmpMask, 0, 0 ); |
|
485 |
mMapOverviewCanvas->setCursor( *mQgis->mOverviewMapCursor ); |
|
486 | ||
487 |
mMapCanvas->enableOverviewMode( mMapOverviewCanvas ); |
|
488 | ||
489 |
// moved here to set anti aliasing to both map canvas and overview |
|
490 |
QSettings mySettings; |
|
491 |
mMapCanvas->enableAntiAliasing( mySettings.value( "/qgis/enable_anti_aliasing", false ).toBool() ); |
|
492 |
mMapCanvas->useImageToRender( mySettings.value( "/qgis/use_qimage_to_render", false ).toBool() ); |
|
493 | ||
494 |
int action = mySettings.value( "/qgis/wheel_action", 0 ).toInt(); |
|
495 |
double zoomFactor = mySettings.value( "/qgis/zoom_factor", 2 ).toDouble(); |
|
496 |
mMapCanvas->setWheelAction(( QgsMapCanvas::WheelAction ) action, zoomFactor ); |
|
497 |
} |
|
498 | ||
499 |
void QgsFrameWidget::createMapTips() |
|
500 |
{ |
|
501 |
// Set up the timer for maptips. The timer is reset everytime the mouse is moved |
|
502 |
mpMapTipsTimer = new QTimer( mMapCanvas ); |
|
503 |
// connect the timer to the maptips slot |
|
504 |
connect( mpMapTipsTimer, SIGNAL( timeout() ), this, SLOT( showMapTip() ) ); |
|
505 |
// set the interval to 0.850 seconds - timer will be started next time the mouse moves |
|
506 |
mpMapTipsTimer->setInterval( 850 ); |
|
507 |
// Create the maptips object |
|
508 |
mpMaptip = new QgsMapTip(); |
|
509 |
} |
|
510 | ||
511 |
void QgsFrameWidget::createStatusBar() |
|
512 |
{ |
|
513 |
mStatusBar = new QStatusBar; |
|
514 |
// |
|
515 |
// Add a panel to the status bar for the scale, coords and progress |
|
516 |
// And also rendering suppression checkbox |
|
517 |
// |
|
518 |
mProgressBar = new QProgressBar( mStatusBar ); |
|
519 |
mProgressBar->setMaximumWidth( 100 ); |
|
520 |
mProgressBar->hide(); |
|
521 |
mProgressBar->setWhatsThis( tr( "Progress bar that displays the status " |
|
522 |
"of rendering layers and other time-intensive operations" ) ); |
|
523 |
mStatusBar->addPermanentWidget( mProgressBar, 1 ); |
|
524 |
// Bumped the font up one point size since 8 was too |
|
525 |
// small on some platforms. A point size of 9 still provides |
|
526 |
// plenty of display space on 1024x768 resolutions |
|
527 |
QFont myFont( "Arial", 9 ); |
|
528 | ||
529 |
mStatusBar->setFont( myFont ); |
|
530 |
//toggle to switch between mouse pos and extents display in status bar widget |
|
531 |
mToggleExtentsViewButton = new QToolButton( mStatusBar ); |
|
532 |
mToggleExtentsViewButton->setMaximumWidth( 20 ); |
|
533 |
mToggleExtentsViewButton->setMaximumHeight( 20 ); |
|
534 |
mToggleExtentsViewButton->setIcon( mQgis->getThemeIcon( "tracking.png" ) ); |
|
535 |
mToggleExtentsViewButton->setToolTip( tr( "Toggle extents and mouse position display" ) ); |
|
536 |
mToggleExtentsViewButton->setCheckable( true ); |
|
537 |
connect( mToggleExtentsViewButton, SIGNAL( toggled( bool ) ), this, SLOT( extentsViewToggled( bool ) ) ); |
|
538 |
mStatusBar->addPermanentWidget( mToggleExtentsViewButton, 0 ); |
|
539 | ||
540 |
// add a label to show current scale |
|
541 |
mCoordsLabel = new QLabel( QString(), mStatusBar ); |
|
542 |
mCoordsLabel->setFont( myFont ); |
|
543 |
mCoordsLabel->setMinimumWidth( 10 ); |
|
544 |
mCoordsLabel->setMaximumHeight( 20 ); |
|
545 |
mCoordsLabel->setMargin( 3 ); |
|
546 |
mCoordsLabel->setAlignment( Qt::AlignCenter ); |
|
547 |
mCoordsLabel->setFrameStyle( QFrame::NoFrame ); |
|
548 |
mCoordsLabel->setText( tr( "Coordinate:" ) ); |
|
549 |
mCoordsLabel->setToolTip( tr( "Current map coordinate" ) ); |
|
550 |
mStatusBar->addPermanentWidget( mCoordsLabel, 0 ); |
|
551 | ||
552 |
//coords status bar widget |
|
553 |
mCoordsEdit = new QLineEdit( QString(), mStatusBar ); |
|
554 |
mCoordsEdit->setFont( myFont ); |
|
555 |
mCoordsEdit->setMinimumWidth( 10 ); |
|
556 |
mCoordsEdit->setMaximumWidth( 200 ); |
|
557 |
mCoordsEdit->setMaximumHeight( 20 ); |
|
558 |
mCoordsEdit->setContentsMargins( 0, 0, 0, 0 ); |
|
559 |
mCoordsEdit->setAlignment( Qt::AlignCenter ); |
|
560 |
mCoordsEdit->setAlignment( Qt::AlignCenter ); |
|
561 |
QRegExp coordValidator( "[+-]?\\d+\\.?\\d*\\s*,\\s*[+-]?\\d+\\.?\\d*" ); |
|
562 |
mCoordsEditValidator = new QRegExpValidator( coordValidator, mCoordsEdit ); |
|
563 |
mCoordsEdit->setWhatsThis( tr( "Shows the map coordinates at the " |
|
564 |
"current cursor position. The display is continuously updated " |
|
565 |
"as the mouse is moved. It also allows editing to set the canvas " |
|
566 |
"center to a given position." ) ); |
|
567 |
mCoordsEdit->setToolTip( tr( "Current map coordinate (formatted as x,y)" ) ); |
|
568 |
mStatusBar->addPermanentWidget( mCoordsEdit, 0 ); |
|
569 |
connect( mCoordsEdit, SIGNAL( editingFinished() ), this, SLOT( userCenter() ) ); |
|
570 | ||
571 |
// add a label to show current scale |
|
572 |
mScaleLabel = new QLabel( QString(), mStatusBar ); |
|
573 |
mScaleLabel->setFont( myFont ); |
|
574 |
mScaleLabel->setMinimumWidth( 10 ); |
|
575 |
mScaleLabel->setMaximumHeight( 20 ); |
|
576 |
mScaleLabel->setMargin( 3 ); |
|
577 |
mScaleLabel->setAlignment( Qt::AlignCenter ); |
|
578 |
mScaleLabel->setFrameStyle( QFrame::NoFrame ); |
|
579 |
mScaleLabel->setText( tr( "Scale " ) ); |
|
580 |
mScaleLabel->setToolTip( tr( "Current map scale" ) ); |
|
581 |
mStatusBar->addPermanentWidget( mScaleLabel, 0 ); |
|
582 | ||
583 |
mScaleEdit = new QLineEdit( QString(), mStatusBar ); |
|
584 |
mScaleEdit->setFont( myFont ); |
|
585 |
mScaleEdit->setMinimumWidth( 10 ); |
|
586 |
mScaleEdit->setMaximumWidth( 100 ); |
|
587 |
mScaleEdit->setMaximumHeight( 20 ); |
|
588 |
mScaleEdit->setContentsMargins( 0, 0, 0, 0 ); |
|
589 |
mScaleEdit->setAlignment( Qt::AlignLeft ); |
|
590 |
QRegExp validator( "\\d+\\.?\\d*:\\d+\\.?\\d*" ); |
|
591 |
mScaleEditValidator = new QRegExpValidator( validator, mScaleEdit ); |
|
592 |
mScaleEdit->setValidator( mScaleEditValidator ); |
|
593 |
mScaleEdit->setWhatsThis( tr( "Displays the current map scale" ) ); |
|
594 |
mScaleEdit->setToolTip( tr( "Current map scale (formatted as x:y)" ) ); |
|
595 |
mStatusBar->addPermanentWidget( mScaleEdit, 0 ); |
|
596 |
connect( mScaleEdit, SIGNAL( editingFinished() ), this, SLOT( userScale() ) ); |
|
597 | ||
598 |
//stop rendering status bar widget |
|
599 |
mStopRenderButton = new QToolButton( mStatusBar ); |
|
600 |
mStopRenderButton->setMaximumWidth( 20 ); |
|
601 |
mStopRenderButton->setMaximumHeight( 20 ); |
|
602 |
mStopRenderButton->setIcon( mQgis->getThemeIcon( "mIconDelete.png" ) ); |
|
603 |
mStopRenderButton->setToolTip( tr( "Stop map rendering" ) ); |
|
604 |
mStatusBar->addPermanentWidget( mStopRenderButton, 0 ); |
|
605 |
// render suppression status bar widget |
|
606 |
mRenderSuppressionCBox = new QCheckBox( tr( "Render" ), mStatusBar ); |
|
607 |
mRenderSuppressionCBox->setChecked( true ); |
|
608 |
mRenderSuppressionCBox->setFont( myFont ); |
|
609 |
mRenderSuppressionCBox->setWhatsThis( tr( "When checked, the map layers " |
|
610 |
"are rendered in response to map navigation commands and other " |
|
611 |
"events. When not checked, no rendering is done. This allows you " |
|
612 |
"to add a large number of layers and symbolize them before rendering." ) ); |
|
613 |
mRenderSuppressionCBox->setToolTip( tr( "Toggle map rendering" ) ); |
|
614 |
mStatusBar->addPermanentWidget( mRenderSuppressionCBox, 0 ); |
|
615 |
// On the fly projection status bar icon |
|
616 |
// Changed this to a tool button since a QPushButton is |
|
617 |
// sculpted on OS X and the icon is never displayed [gsherman] |
|
618 |
mOnTheFlyProjectionStatusButton = new QToolButton( mStatusBar ); |
|
619 |
mOnTheFlyProjectionStatusButton->setMaximumWidth( 20 ); |
|
620 |
// Maintain uniform widget height in status bar by setting button height same as labels |
|
621 |
// For Qt/Mac 3.3, the default toolbutton height is 30 and labels were expanding to match |
|
622 |
mOnTheFlyProjectionStatusButton->setMaximumHeight( mScaleLabel->height() ); |
|
623 |
mOnTheFlyProjectionStatusButton->setIcon( mQgis->getThemeIcon( "mIconProjectionDisabled.png" ) ); |
|
624 |
if ( !QFile::exists( QgsApplication::defaultThemePath() + "/mIconProjectionDisabled.png" ) ) |
|
625 |
{ |
|
626 |
QMessageBox::critical( this, tr( "Resource Location Error" ), |
|
627 |
tr( "Error reading icon resources from: \n %1\n Quitting..." ).arg( |
|
628 |
QgsApplication::defaultThemePath() + "/mIconProjectionDisabled.png" |
|
629 |
) ); |
|
630 |
exit( 0 ); |
|
631 |
} |
|
632 |
mOnTheFlyProjectionStatusButton->setWhatsThis( tr( "This icon shows whether " |
|
633 |
"on the fly coordinate reference system transformation is enabled or not. " |
|
634 |
"Click the icon to bring up " |
|
635 |
"the project properties dialog to alter this behaviour." ) ); |
|
636 |
mOnTheFlyProjectionStatusButton->setToolTip( tr( "CRS status - Click " |
|
637 |
"to open coordinate reference system dialog" ) ); |
|
638 |
connect( mOnTheFlyProjectionStatusButton, SIGNAL( clicked() ), |
|
639 |
this, SLOT( projectPropertiesProjections() ) );//bring up the project props dialog when clicked |
|
640 |
mStatusBar->addPermanentWidget( mOnTheFlyProjectionStatusButton, 0 ); |
|
641 |
mStatusBar->showMessage( tr( "Ready" ) ); |
|
642 |
} |
|
643 | ||
644 |
void QgsFrameWidget::setToolsForMapCanvas( QgsMapCanvas *theMapCanvas, QgisApp::Tools *theMapTools ) |
|
645 |
{ |
|
646 |
// "theMapCanvas" used to find this canonical instance later |
|
647 |
theMapCanvas->setWhatsThis( tr( "Map canvas. This is where raster and vector " |
|
648 |
"layers are displayed when added to the map" ) ); |
|
649 | ||
650 |
// set the focus to the map canvas |
|
651 |
theMapCanvas->setFocus(); |
|
652 | ||
653 |
// create tools |
|
654 |
theMapTools->mZoomIn = new QgsMapToolZoom( theMapCanvas, false /* zoomIn */ ); |
|
655 |
theMapTools->mZoomIn->setAction( mQgis->actionZoomIn() ); |
|
656 |
theMapTools->mZoomOut = new QgsMapToolZoom( theMapCanvas, true /* zoomOut */ ); |
|
657 |
theMapTools->mZoomOut->setAction( mQgis->actionZoomOut() ); |
|
658 |
theMapTools->mPan = new QgsMapToolPan( theMapCanvas ); |
|
659 |
theMapTools->mPan->setAction( mQgis->actionPan() ); |
|
660 |
theMapTools->mIdentify = new QgsMapToolIdentify( theMapCanvas ); |
|
661 |
theMapTools->mIdentify->setAction( mQgis->actionIdentify() ); |
|
662 |
theMapTools->mMeasureDist = new QgsMeasureTool( theMapCanvas, false /* area */ ); |
|
663 |
theMapTools->mMeasureDist->setAction( mQgis->actionMeasure() ); |
|
664 |
theMapTools->mMeasureArea = new QgsMeasureTool( theMapCanvas, true /* area */ ); |
|
665 |
theMapTools->mMeasureArea->setAction( mQgis->actionMeasureArea() ); |
|
666 |
theMapTools->mCapturePoint = new QgsMapToolAddFeature( theMapCanvas, QgsMapToolCapture::CapturePoint ); |
|
667 |
theMapTools->mCapturePoint->setAction( mQgis->actionCapturePoint() ); |
|
668 |
mQgis->actionCapturePoint()->setVisible( false ); |
|
669 |
theMapTools->mCaptureLine = new QgsMapToolAddFeature( theMapCanvas, QgsMapToolCapture::CaptureLine ); |
|
670 |
theMapTools->mCaptureLine->setAction( mQgis->actionCaptureLine() ); |
|
671 |
mQgis->actionCaptureLine()->setVisible( false ); |
|
672 |
theMapTools->mCapturePolygon = new QgsMapToolAddFeature( theMapCanvas, QgsMapToolCapture::CapturePolygon ); |
|
673 |
theMapTools->mCapturePolygon->setAction( mQgis->actionCapturePolygon() ); |
|
674 |
mQgis->actionCapturePolygon()->setVisible( false ); |
|
675 |
theMapTools->mMoveFeature = new QgsMapToolMoveFeature( theMapCanvas ); |
|
676 |
theMapTools->mMoveFeature->setAction( mQgis->actionMoveFeature() ); |
|
677 |
theMapTools->mSplitFeatures = new QgsMapToolSplitFeatures( theMapCanvas ); |
|
678 |
theMapTools->mSplitFeatures->setAction( mQgis->actionSplitFeatures() ); |
|
679 |
theMapTools->mSelect = new QgsMapToolSelect( theMapCanvas ); |
|
680 |
theMapTools->mSelect->setAction( mQgis->actionSelect() ); |
|
681 |
theMapTools->mVertexAdd = new QgsMapToolAddVertex( theMapCanvas ); |
|
682 |
theMapTools->mVertexAdd->setAction( mQgis->actionAddVertex() ); |
|
683 |
theMapTools->mVertexMove = new QgsMapToolMoveVertex( theMapCanvas ); |
|
684 |
theMapTools->mVertexMove->setAction( mQgis->actionMoveVertex() ); |
|
685 |
theMapTools->mVertexDelete = new QgsMapToolDeleteVertex( theMapCanvas ); |
|
686 |
theMapTools->mVertexDelete->setAction( mQgis->actionDeleteVertex() ); |
|
687 |
theMapTools->mAddRing = new QgsMapToolAddRing( theMapCanvas ); |
|
688 |
theMapTools->mAddRing->setAction( mQgis->actionAddRing() ); |
|
689 |
theMapTools->mAddIsland = new QgsMapToolAddIsland( theMapCanvas ); |
|
690 |
theMapTools->mSimplifyFeature = new QgsMapToolSimplify( theMapCanvas ); |
|
691 |
theMapTools->mSimplifyFeature->setAction( mQgis->actionSimplifyFeature() ); |
|
692 |
theMapTools->mDeleteRing = new QgsMapToolDeleteRing( theMapCanvas ); |
|
693 |
theMapTools->mDeleteRing->setAction( mQgis->actionDeleteRing() ); |
|
694 |
theMapTools->mDeletePart = new QgsMapToolDeletePart( theMapCanvas ); |
|
695 |
theMapTools->mDeletePart->setAction( mQgis->actionDeletePart() ); |
|
696 |
theMapTools->mNodeTool = new QgsMapToolNodeTool( theMapCanvas ); |
|
697 |
theMapTools->mNodeTool->setAction( mQgis->actionNodeTool() ); |
|
698 | ||
699 |
// set a current map tool |
|
700 |
theMapTools->mCurrentTool = theMapTools->mPan; |
|
701 | ||
702 |
//ensure that non edit tool is initialised or we will get crashes in some situations |
|
703 |
mQgis->mNonEditMapTool = theMapTools->mPan; |
|
704 |
} // setToolsForMapCanvas |
src/app/qgisappinterface.h (working copy) | ||
---|---|---|
87 | 87 |
/** Return a pointer to the map canvas used by qgisapp */ |
88 | 88 |
QgsMapCanvas * mapCanvas(); |
89 | 89 | |
90 |
#ifdef HAVE_TABS |
|
91 |
/** Return a pointer to the main tab widget that containing map canvas */ |
|
92 |
QgsDeskTabWidgetInterface * deskTabWidget(); |
|
93 |
#endif |
|
90 | 94 |
/** Gives access to main QgisApp object |
91 | 95 | |
92 | 96 |
Plugins don't need to know about QgisApp, as we pass it as QWidget, |
src/app/composer/qgscomposer.cpp (working copy) | ||
---|---|---|
38 | 38 |
#include "qgsmessageviewer.h" |
39 | 39 |
#include "qgscontexthelp.h" |
40 | 40 |
#include "qgscursors.h" |
41 |
#ifdef HAVE_TABS |
|
42 |
#include "tabs/qgswidgetregistry.h" |
|
43 |
#endif |
|
41 | 44 | |
42 | 45 |
#include <QCloseEvent> |
43 | 46 |
#include <QDesktopWidget> |
... | ... | |
48 | 51 |
#include <QMessageBox> |
49 | 52 |
#include <QPainter> |
50 | 53 | |
54 |
#ifdef HAVE_TABS |
|
55 |
#include <QDockWidget> |
|
56 |
#include <QStatusBar> |
|
57 |
#endif |
|
58 | ||
51 | 59 |
#include <QPrinter> |
52 | 60 |
#include <QPrintDialog> |
53 | 61 |
#include <QSettings> |
... | ... | |
1396 | 1404 |
on_mActionSelectMoveItem_triggered(); |
1397 | 1405 |
} |
1398 | 1406 | |
1407 |
#ifdef HAVE_TABS |
|
1408 |
void QgsComposer::prepareTabbing() |
|
1409 |
{ |
|
1410 |
QList< QToolBar * > tbs = mQgis->findChildren< QToolBar * >(); |
|
1411 |
foreach ( QToolBar *tb, tbs ) |
|
1412 |
tb->hide(); |
|
1413 | ||
1414 |
QSize iconSize = mQgis->mapNavToolToolBar()->iconSize(); |
|
1415 |
toolBar->setIconSize(iconSize); |
|
1416 | ||
1417 |
mQgis->addToolBar( toolBar ); |
|
1418 |
toolBar->show(); |
|
1419 | ||
1420 |
statusBar()->close(); |
|
1421 |
statusBar()->setParent(0); |
|
1422 |
buttonBox->close(); |
|
1423 | ||
1424 |
mComposerMenuBar = menuBar(); |
|
1425 | ||
1426 |
mQgisStateByteArray = mQgis->saveState(); |
|
1427 |
} |
|
1428 | ||
1429 |
void QgsComposer::restoreState( int tabIndex ) |
|
1430 |
{ |
|
1431 |
int i = QgsWidgetRegistry::tabIndexOf(this); |
|
1432 |
if ( tabIndex == i ) |
|
1433 |
{ |
|
1434 |
mQgis->menuBar()->close(); |
|
1435 |
mQgis->menuBar()->setParent(0); |
|
1436 | ||
1437 |
mQgis->setMenuBar(mComposerMenuBar); |
|
1438 |
mQgis->menuBar()->show(); |
|
1439 | ||
1440 |
mQgis->restoreState(mQgisStateByteArray, tabIndex); |
|
1441 |
mQgis->statusBar()->hide(); |
|
1442 |
} |
|
1443 |
else if (mComposerMenuBar->isVisible()) |
|
1444 |
{ |
|
1445 |
mComposerMenuBar->close(); |
|
1446 |
mComposerMenuBar->setParent(0); |
|
1447 |
} |
|
1448 |
} |
|
1449 |
#endif |
|
1450 | ||
1399 | 1451 |
bool QgsComposer::containsWMSLayer() const |
1400 | 1452 |
{ |
1401 | 1453 |
QMap<QgsComposerItem*, QWidget*>::const_iterator item_it = mItemWidgetMap.constBegin(); |
src/app/composer/qgscomposer.h (working copy) | ||
---|---|---|
19 | 19 |
#define QGSCOMPOSER_H |
20 | 20 |
#include "ui_qgscomposerbase.h" |
21 | 21 |
#include "qgscomposeritem.h" |
22 |
#include "qgsconfig.h" |
|
22 | 23 | |
23 | 24 |
class QgisApp; |
24 | 25 |
class QgsComposerLabel; |
... | ... | |
77 | 78 | |
78 | 79 |
QString id() const {return mId;} |
79 | 80 | |
81 |
#ifdef HAVE_TABS |
|
82 |
void prepareTabbing(); |
|
83 |
#endif |
|
84 | ||
80 | 85 |
protected: |
81 | 86 |
//! Move event |
82 | 87 |
virtual void moveEvent( QMoveEvent * ); |
... | ... | |
225 | 230 | |
226 | 231 |
void setSelectionTool(); |
227 | 232 | |
233 |
#ifdef HAVE_TABS |
|
234 |
void restoreState(int tabIndex); |
|
235 |
#endif |
|
236 | ||
228 | 237 |
private slots: |
229 | 238 | |
230 | 239 |
//! Raise, unminimize and activate this window |
231 | 240 |
void activate(); |
232 | 241 | |
233 | 242 |
private: |
234 | ||
235 | 243 |
/**Establishes the signal slot connection for the class*/ |
236 | 244 |
void connectSlots(); |
237 | 245 | |
... | ... | |
283 | 291 |
//! Help context id |
284 | 292 |
static const int context_id = 985715179; |
285 | 293 | |
294 |
// window state of composer |
|
295 |
QByteArray mQgisStateByteArray; |
|
296 | ||
297 |
// Composer menuBar |
|
298 |
QMenuBar *mComposerMenuBar; |
|
286 | 299 |
}; |
287 | 300 | |
288 | 301 |
#endif |
src/app/qgisapp.h (working copy) | ||
---|---|---|
68 | 68 |
#include "qgsfeature.h" |
69 | 69 |
#include "qgspoint.h" |
70 | 70 | |
71 |
#ifdef HAVE_TABS |
|
72 |
class QgsFrameWidget; |
|
73 |
class QgsMapOverviewCanvas; |
|
74 |
class QgsDeskTabWidget; |
|
75 |
class QgsLegendTabWidget; |
|
76 |
class QgsAddTabDialog; |
|
77 |
#endif |
|
78 | ||
71 | 79 |
/*! \class QgisApp |
72 | 80 |
* \brief Main window for the Qgis application |
73 | 81 |
*/ |
... | ... | |
141 | 149 |
//!Overloaded version of the private function with same name that takes the imagename as a parameter |
142 | 150 |
void saveMapAsImage( QString, QPixmap * ); |
143 | 151 |
/** Get the mapcanvas object from the app */ |
144 |
QgsMapCanvas * mapCanvas() { return mMapCanvas; }; |
|
145 | ||
152 |
QgsMapCanvas * mapCanvas() { return mMapCanvas; } |
|
153 |
#ifdef HAVE_TABS |
|
154 |
/** Get the main (desk) tabwidget object from the app */ |
|
155 |
QgsDeskTabWidget *deskTabWidget() { return mDeskTabWidget; } |
|
156 |
/** Get the legend tabwidget object from the app */ |
|
157 |
QgsLegendTabWidget *legendTabWidget() { return mLegendTabWidget; } |
|
158 |
// Create print composer but don't add it in composer map |
|
159 |
QgsComposer *createPrintComposer(QString composerId); |
|
160 |
#endif |
|
146 | 161 |
//! Set theme (icons) |
147 | 162 |
void setTheme( QString themeName = "default" ); |
148 | 163 |
//! Setup the toolbar popup menus for a given theme |
... | ... | |
182 | 197 |
* After adding the dock widget to the ui (by delegating to the QMainWindow |
183 | 198 |
* parent class, it will also add it to the View menu list of docks.*/ |
184 | 199 |
void addDockWidget( Qt::DockWidgetArea area, QDockWidget * dockwidget ); |
200 |
#ifndef HAVE_TABS |
|
185 | 201 |
/** Add a toolbar to the main window. Overloaded from QMainWindow. |
186 | 202 |
* After adding the toolbar to the ui (by delegating to the QMainWindow |
187 | 203 |
* parent class, it will also add it to the View menu list of toolbars.*/ |
188 | 204 |
QToolBar *addToolBar( QString name ); |
189 | ||
205 |
#endif |
|
190 | 206 |
/** Add window to Window menu. The action title is the window title |
191 | 207 |
* and the action should raise, unminimize and activate the window. */ |
192 | 208 |
void addWindow( QAction *action ); |
... | ... | |
202 | 218 | |
203 | 219 |
//! Actions to be inserted in menus and toolbars |
204 | 220 |
QAction *actionNewProject() { return mActionNewProject; } |
221 |
#ifdef HAVE_TABS |
|
222 |
QAction *actionNewTab() { return mActionAddTabDialog; } |
|
223 |
QAction *actionNewCanvasTab() { return mActionCanvasTab; } |
|
224 |
QAction *actionCloseTab() { return mActionCloseTab; } |
|
225 |
QAction *actionRestoreTab() { return mActionRestoreTab; } |
|
226 |
#endif |
|
205 | 227 |
QAction *actionOpenProject() { return mActionOpenProject; } |
206 | 228 |
QAction *actionFileSeparator1() { return mActionFileSeparator1; } |
207 | 229 |
QAction *actionSaveProject() { return mActionSaveProject; } |
... | ... | |
398 | 420 |
//#endif |
399 | 421 |
/** toggles whether the current selected layer is in overview or not */ |
400 | 422 |
void isInOverview(); |
423 |
#ifndef HAVE_TABS |
|
401 | 424 |
//! Slot to show the map coordinate position of the mouse cursor |
402 | 425 |
void showMouseCoordinate( const QgsPoint & ); |
403 | 426 |
//! Slot to show current map scale; |
... | ... | |
406 | 429 |
void userScale(); |
407 | 430 |
//! Slot to handle user center input; |
408 | 431 |
void userCenter(); |
432 |
#endif |
|
409 | 433 |
//! Remove a layer from the map and legend |
410 | 434 |
void removeLayer(); |
411 | 435 |
//! zoom to extent of layer |
... | ... | |
437 | 461 |
//! Open the project file corresponding to the |
438 | 462 |
//! text)= of the given action. |
439 | 463 |
void openProject( QAction *action ); |
464 |
#ifdef HAVE_TABS |
|
465 |
void addTabDialog(); |
|
466 |
void addCanvasTab(); |
|
467 |
void closeTab(); |
|
468 |
void restoreTab(); |
|
469 |
void nextTab(); |
|
470 |
void previousTab(); |
|
471 | ||
472 |
void updateFrame( QgsFrameWidget *frame ); |
|
473 |
#endif |
|
440 | 474 |
//! Save the map view as an image - user is prompted for image name using a dialog |
441 | 475 |
void saveMapAsImage(); |
442 | 476 |
//! Open a project |
... | ... | |
487 | 521 |
void socketError( QAbstractSocket::SocketError e ); |
488 | 522 |
//! Set project properties, including map untis |
489 | 523 |
void projectProperties(); |
524 |
#ifndef HAVE_TABS |
|
490 | 525 |
//! Open project properties dialog and show the projections tab |
491 | 526 |
void projectPropertiesProjections(); |
527 |
#endif |
|
492 | 528 |
/* void urlData(); */ |
493 | 529 |
//! Show the spatial bookmarks dialog |
494 | 530 |
void showBookmarks(); |
... | ... | |
541 | 577 |
//! starts/stops editing mode of the current layer |
542 | 578 |
void toggleEditing(); |
543 | 579 | |
580 |
#ifndef HAVE_TABS |
|
544 | 581 |
//! map tool changed |
545 | 582 |
void mapToolChanged( QgsMapTool *tool ); |
583 |
#endif |
|
546 | 584 | |
547 | 585 |
/** Activates or deactivates actions depending on the current maplayer type. |
548 | 586 |
Is called from the legend when the current legend item has changed*/ |
549 | 587 |
void activateDeactivateLayerRelatedActions( QgsMapLayer* layer ); |
550 | 588 | |
589 |
#ifndef HAVE_TABS |
|
551 | 590 |
void showProgress( int theProgress, int theTotalSteps ); |
552 | 591 |
void extentsViewToggled( bool theFlag ); |
553 | 592 |
void showExtents(); |
554 | 593 |
void showStatusMessage( QString theMessage ); |
594 |
#endif |
|
595 |
#ifdef HAVE_TABS |
|
555 | 596 |
void updateMouseCoordinatePrecision(); |
597 |
#endif |
|
598 |
#ifndef HAVE_TABS |
|
556 | 599 |
void hasCrsTransformEnabled( bool theFlag ); |
557 | 600 |
void destinationSrsChanged(); |
601 |
#endif |
|
558 | 602 |
// void debugHook(); |
559 | 603 |
//! Add a vector layer to the map |
560 | 604 |
void addVectorLayer(); |
... | ... | |
596 | 640 | |
597 | 641 |
//! Toggle map tips on/off |
598 | 642 |
void toggleMapTips(); |
599 | ||
643 |
#ifndef HAVE_TABS |
|
600 | 644 |
//! Show the map tip |
601 | 645 |
void showMapTip(); |
602 | ||
646 |
#endif |
|
603 | 647 |
//! Toggle full screen mode |
604 | 648 |
void toggleFullScreen(); |
605 | 649 | |
... | ... | |
663 | 707 |
bool isValidVectorFileName( QString theFileNameQString ); |
664 | 708 |
/** Overloaded version of the above function provided for convenience that takes a qstring pointer */ |
665 | 709 |
bool isValidVectorFileName( QString * theFileNameQString ); |
710 | ||
666 | 711 |
/** add this file to the recently opened/saved projects list |
667 | 712 |
* pass settings by reference since creating more than one |
668 | 713 |
* instance simultaneously results in data loss. |
... | ... | |
696 | 741 |
void createActionGroups(); |
697 | 742 |
void createMenus(); |
698 | 743 |
void createToolBars(); |
744 |
#ifndef HAVE_TABS |
|
699 | 745 |
void createStatusBar(); |
746 |
#endif |
|
700 | 747 |
void setupConnections(); |
748 |
#ifndef HAVE_TABS |
|
701 | 749 |
void createLegend(); |
750 |
#else |
|
702 | 751 |
void createOverview(); |
752 |
void createLegendDock(); |
|
753 |
void createOverviewDock(); |
|
754 |
#endif |
|
703 | 755 |
void createCanvas(); |
704 | 756 |
bool createDB(); |
757 |
#ifndef HAVE_TABS |
|
705 | 758 |
void createMapTips(); |
759 |
#endif |
|
706 | 760 | |
707 | 761 |
// toolbars --------------------------------------- |
708 | 762 |
QToolBar *mFileToolBar; |
... | ... | |
717 | 771 |
// actions for menus and toolbars ----------------- |
718 | 772 | |
719 | 773 |
QAction *mActionNewProject; |
774 |
#ifdef HAVE_TABS |
|
775 |
QAction *mActionAddTabDialog; |
|
776 |
QAction *mActionCanvasTab; |
|
777 |
QAction *mActionNextTab; |
|
778 |
QAction *mActionPreviousTab; |
|
779 |
QAction *mActionCloseTab; |
|
780 |
QAction *mActionRestoreTab; |
|
781 |
#endif |
|
720 | 782 |
QAction *mActionOpenProject; |
721 | 783 |
QAction *mActionFileSeparator1; |
722 | 784 |
QAction *mActionSaveProject; |
... | ... | |
856 | 918 |
class Tools |
857 | 919 |
{ |
858 | 920 |
public: |
921 |
#ifdef HAVE_TABS |
|
922 |
~Tools(); |
|
923 |
#endif |
|
859 | 924 |
QgsMapTool* mZoomIn; |
860 | 925 |
QgsMapTool* mZoomOut; |
861 | 926 |
QgsMapTool* mPan; |
... | ... | |
879 | 944 |
QgsMapTool* mDeletePart; |
880 | 945 |
QgsMapTool* mNodeTool; |
881 | 946 |
QgsMapTool* mRotatePointSymbolsTool; |
947 |
#ifndef HAVE_TABS |
|
882 | 948 |
} mMapTools; |
949 |
#else |
|
950 |
QgsMapTool* mCurrentTool; |
|
951 |
} *mMapTools; |
|
952 |
#endif |
|
883 | 953 | |
884 | 954 |
QgsMapTool *mNonEditMapTool; |
885 | ||
955 |
#ifndef HAVE_TABS |
|
886 | 956 |
//! Widget that will live on the statusbar to display "scale 1:" |
887 | 957 |
QLabel * mScaleLabel; |
888 | 958 |
//! Widget that will live on the statusbar to display scale value |
... | ... | |
905 | 975 |
QToolButton* mStopRenderButton; |
906 | 976 |
//! Widget in status bar used to show status of on the fly projection |
907 | 977 |
QToolButton * mOnTheFlyProjectionStatusButton; |
978 |
#endif |
|
908 | 979 |
//! Popup menu |
909 | 980 |
QMenu * mPopupMenu; |
910 | 981 |
//! Top level plugin menu |
... | ... | |
917 | 988 |
QMenu *toolPopupCapture; |
918 | 989 |
//! Map canvas |
919 | 990 |
QgsMapCanvas *mMapCanvas; |
991 |
#ifdef HAVE_TABS |
|
992 |
friend class QgsFrameWidget; |
|
993 |
//! Desk (main) tab widget |
|
994 |
QgsDeskTabWidget *mDeskTabWidget; |
|
995 |
//! Map overview canvas |
|
996 |
QgsMapOverviewCanvas *mMapOverviewCanvas; |
|
997 |
//! Legend tab widget |
|
998 |
QgsLegendTabWidget *mLegendTabWidget; |
|
999 |
//! Dialog for adding tab |
|
1000 |
QgsAddTabDialog *mAddTabDialog; |
|
1001 |
#endif |
|
920 | 1002 |
//! Table of contents (legend) for the map |
921 | 1003 |
QgsLegend *mMapLegend; |
922 | 1004 |
//! Cursor for the overview map |
... | ... | |
948 | 1030 |
//! How to determine the number of decimal places used to |
949 | 1031 |
//! display the mouse position |
950 | 1032 |
bool mMousePrecisionAutomatic; |
1033 |
#ifdef HAVE_TABS |
|
951 | 1034 |
//! The number of decimal places to use if not automatic |
952 | 1035 |
unsigned int mMousePrecisionDecimalPlaces; |
1036 |
#endif |
|
953 | 1037 |
/** QGIS-internal vector feature clipboard */ |
954 | 1038 |
QgsClipboard* mInternalClipboard; |
955 | 1039 |
//! Flag to indicate how the project properties dialog was summoned |
... | ... | |
963 | 1047 |
*/ |
964 | 1048 |
QString mRasterFileFilter; |
965 | 1049 | |
1050 |
#ifndef HAVE_TABS |
|
966 | 1051 |
/** Timer for map tips |
967 | 1052 |
*/ |
968 | 1053 |
QTimer *mpMapTipsTimer; |
... | ... | |
977 | 1062 | |
978 | 1063 |
// Flag to indicate if maptips are on or off |
979 | 1064 |
bool mMapTipsVisible; |
1065 |
#endif |
|
980 | 1066 | |
981 | 1067 |
//!flag to indicate whether we are in fullscreen mode or not |
982 | 1068 |
bool mFullScreenMode; |
src/app/qgsframewidget.h (revision 0) | ||
---|---|---|
1 |
#ifndef QGSFRAMEWIDGET_H |
|
2 |
#define QGSFRAMEWIDGET_H |
|
3 | ||
4 |
#include <QWidget> |
|
5 | ||
6 |
#include "qgisapp.h" |
|
7 | ||
8 |
// this class holds map canvas, map legend, and map overview canvas, map tools and statusbar |
|
9 |
// it is used to communicate with class QgisApp |
|
10 |
class QgsFrameWidget : public QWidget |
|
11 |
{ |
|
12 |
Q_OBJECT |
|
13 | ||
14 |
public: |
|
15 |
QgsFrameWidget( QgisApp *qgis ); |
|
16 |
~QgsFrameWidget(); |
|
17 | ||
18 |
QgsMapCanvas *mapCanvas() { return mMapCanvas; } |
|
19 |
QgsMapOverviewCanvas *mapOverviewCanvas() { return mMapOverviewCanvas; } |
|
20 |
QgsLegend *legend() { return mLegend; } |
|
21 |
QgisApp::Tools *tools() { return mTools; } |
|
22 |
QStatusBar *statusBar() { return mStatusBar; } |
|
23 | ||
24 |
void setupConnections(); |
|
25 |
void removeConnections(); |
|
26 |
void saveState(); |
|
27 |
void restoreState(); |
|
28 | ||
29 |
private slots: |
|
30 |
void destinationSrsChanged(); |
|
31 |
void hasCrsTransformEnabled( bool theFlag ); |
|
32 |
void mapToolChanged( QgsMapTool *tool ); |
|
33 |
void projectPropertiesProjections(); |
|
34 | ||
35 |
void showProgress( int theProgress, int theTotalSteps ); |
|
36 |
void showMouseCoordinate( const QgsPoint & p ); |
|
37 |
void showScale( double theScale ); |
|
38 |
void showExtents(); |
|
39 |
void showMapTip(); |
|
40 | ||
41 |
void extentsViewToggled( bool theFlag ); |
|
42 |
void updateMouseCoordinatePrecision(); |
|
43 |
void userScale(); |
|
44 |
void userCenter(); |
|
45 | ||
46 |
void layerWasAdded( QgsMapLayer *layer ); |
|
47 | ||
48 |
private: |
|
49 |
void createCanvas(); |
|
50 |
void createLegend(); |
|
51 |
void createOverview(); |
|
52 |
void createMapTips(); |
|
53 |
void createStatusBar(); |
|
54 | ||
55 |
void setToolsForMapCanvas( QgsMapCanvas *theMapCanvas, QgisApp::Tools *theMapTools ); |
|
56 | ||
57 |
QgsMapCanvas *mMapCanvas; |
|
58 |
QgsLegend *mLegend; |
|
59 |
QgsMapOverviewCanvas *mMapOverviewCanvas; |
|
60 |
QgisApp::Tools *mTools; |
|
61 |
QStatusBar *mStatusBar; |
|
62 | ||
63 |
//! Widget that will live in the statusbar to show progress of operations |
|
64 |
QProgressBar * mProgressBar; |
|
65 |
//! A toggle to switch between mouse coords and view extents display |
|
66 |
QToolButton * mToggleExtentsViewButton; |
|
67 |
//! Widget that will live in the statusbar to display coords |
|
68 |
QLabel * mCoordsLabel; |
|
69 |
//! Widget that will live on the statusbar to display "scale 1:" |
|
70 |
QLabel * mScaleLabel; |
|
71 |
//! Widget that will live in the statusbar to display and edit coords |
|
72 |
QLineEdit * mCoordsEdit; |
|
73 |
//! The validator for the mCoordsEdit |
|
74 |
QValidator * mCoordsEditValidator; |
|
75 |
//! Widget that will live on the statusbar to display scale value |
|
76 |
QLineEdit * mScaleEdit; |
|
77 |
//! The validator for the mScaleEdit |
|
78 |
QValidator * mScaleEditValidator; |
|
79 |
//! Button used to stop rendering |
|
80 |
QToolButton* mStopRenderButton; |
|
81 |
//! Widget used to suppress rendering |
|
82 |
QCheckBox * mRenderSuppressionCBox; |
|
83 |
//! Widget in status bar used to show status of on the fly projection |
|
84 |
QToolButton * mOnTheFlyProjectionStatusButton; |
|
85 | ||
86 |
//! The number of decimal places to use if not automatic |
|
87 |
unsigned int mMousePrecisionDecimalPlaces; |
|
88 | ||
89 |
/** Timer for map tips |
|
90 |
*/ |
|
91 |
QTimer *mpMapTipsTimer; |
|
92 | ||
93 |
/** Point of last mouse position in map coordinates (used with MapTips) |
|
94 |
*/ |
|
95 |
QgsPoint mLastMapPosition; |
|
96 | ||
97 |
/* Maptip object |
|
98 |
*/ |
|
99 |
QgsMapTip * mpMaptip; |
|
100 | ||
101 |
// Flag to indicate if maptips are on or off |
|
102 |
bool mMapTipsVisible; |
|
103 | ||
104 |
// state of QGis for this frame |
|
105 |
QByteArray mQgisState; |
|
106 | ||
107 |
QgisApp *mQgis; |
|
108 | ||
109 |
// QGis menuBar |
|
110 |
QMenuBar *mQgisMenuBar; |
|
111 |
}; |
|
112 | ||
113 |
#endif // QGSFRAMEWIDGET_H |
src/app/CMakeLists.txt (working copy) | ||
---|---|---|
109 | 109 |
attributetable/qgsattributetabledelegate.cpp |
110 | 110 |
) |
111 | 111 | |
112 |
IF (HAVE_TABS) |
|
113 |
SET (QGIS_APP_SRCS ${QGIS_APP_SRCS} |
|
114 |
qgsframewidget.cpp |
|
115 |
) |
|
116 |
ENDIF (HAVE_TABS) |
|
112 | 117 | |
113 | 118 |
SET (QGIS_APP_MOC_HDRS |
114 | 119 |
qgisapp.h |
... | ... | |
195 | 200 |
attributetable/qgsattributetabledelegate.h |
196 | 201 |
) |
197 | 202 | |
203 |
IF (HAVE_TABS) |
|
204 |
SET (QGIS_APP_MOC_HDRS ${QGIS_APP_MOC_HDRS} |
|
205 |
qgsframewidget.h |
|
206 |
) |
|
207 |
ENDIF (HAVE_TABS) |
|
208 | ||
198 | 209 |
IF (POSTGRES_FOUND) |
199 | 210 |
IF(HAVE_PGCONFIG) |
200 | 211 |
ADD_DEFINITIONS(-DHAVE_PGCONFIG=1) |
src/app/qgisapp.cpp (working copy) | ||
---|---|---|
138 | 138 |
#include "qgsvectorlayer.h" |
139 | 139 |
#include "ogr/qgsopenvectorlayerdialog.h" |
140 | 140 |
#include "qgsattributetabledialog.h" |
141 |
#ifdef HAVE_TABS |
|
142 |
#include "qgsframewidget.h" |
|
143 |
#include "tabs/qgsaddtabdialog.h" |
|
144 |
#include "tabs/qgsdesktabwidget.h" |
|
145 |
#include "tabs/qgslegendtabwidget.h" |
|
146 |
#include "tabs/qgswidgetregistry.h" |
|
147 |
#endif |
|
141 | 148 |
// |
142 | 149 |
// Gdal/Ogr includes |
143 | 150 |
// |
... | ... | |
326 | 333 |
// constructor starts here |
327 | 334 |
QgisApp::QgisApp( QSplashScreen *splash, QWidget * parent, Qt::WFlags fl ) |
328 | 335 |
: QMainWindow( parent, fl ), |
336 |
#ifdef HAVE_TABS |
|
337 |
mMapCanvas( 0 ), |
|
338 |
mMapLegend( 0 ), |
|
339 |
#endif |
|
329 | 340 |
mSplash( splash ), |
330 | 341 |
mPythonConsole( NULL ), |
331 | 342 |
mPythonUtils( NULL ) |
... | ... | |
355 | 366 | |
356 | 367 |
mSplash->showMessage( tr( "Setting up the GUI" ), Qt::AlignHCenter | Qt::AlignBottom ); |
357 | 368 |
qApp->processEvents(); |
358 | ||
359 | ||
360 | ||
369 |
#ifdef HAVE_TABS |
|
370 |
setDockOptions(QMainWindow::ForceTabbedDocks); |
|
371 |
#endif |
|
361 | 372 |
createActions(); |
362 | 373 |
createActionGroups(); |
363 | 374 |
createMenus(); |
364 | 375 |
createToolBars(); |
376 |
#ifndef HAVE_TABS |
|
365 | 377 |
createStatusBar(); |
378 |
#endif |
|
379 |
#ifdef HAVE_TABS |
|
380 |
createOverview(); |
|
381 |
createOverviewDock(); |
|
382 |
#endif |
|
366 | 383 |
createCanvas(); |
367 | 384 |
mMapCanvas->freeze(); |
385 |
#ifdef HAVE_TABS |
|
386 |
createLegendDock(); |
|
387 |
#else |
|
368 | 388 |
createLegend(); |
369 | 389 |
createOverview(); |
370 | 390 |
createMapTips(); |
391 |
#endif |
|
371 | 392 |
readSettings(); |
372 | 393 |
updateRecentProjectPaths(); |
373 | ||
394 |
#ifdef HAVE_TABS |
|
395 |
mAddTabDialog = new QgsAddTabDialog(); // Dialog for opening tabs |
|
396 |
#endif |
|
374 | 397 |
mInternalClipboard = new QgsClipboard; // create clipboard |
375 | 398 |
mQgisInterface = new QgisAppInterface( this ); // create the interfce |
376 | 399 | |
... | ... | |
450 | 473 |
restoreWindowState(); |
451 | 474 | |
452 | 475 |
mSplash->showMessage( tr( "QGIS Ready!" ), Qt::AlignHCenter | Qt::AlignBottom ); |
453 | ||
476 |
#ifndef HAVE_TABS |
|
454 | 477 |
mMapTipsVisible = false; |
455 | ||
478 |
#endif |
|
456 | 479 |
// setup drag drop |
457 | 480 |
setAcceptDrops( true ); |
458 | 481 | |
... | ... | |
472 | 495 | |
473 | 496 |
QgisApp::~QgisApp() |
474 | 497 |
{ |
475 |
delete mInternalClipboard; |
|
476 |
delete mQgisInterface; |
|
477 | ||
498 |
#ifndef HAVE_TABS |
|
478 | 499 |
delete mMapTools.mZoomIn; |
479 | 500 |
delete mMapTools.mZoomOut; |
480 | 501 |
delete mMapTools.mPan; |
... | ... | |
497 | 518 |
delete mMapTools.mDeletePart; |
498 | 519 |
delete mMapTools.mAddIsland; |
499 | 520 |
delete mMapTools.mNodeTool; |
521 |
#endif |
|
500 | 522 | |
523 |
delete mInternalClipboard; |
|
524 |
delete mQgisInterface; |
|
525 | ||
501 | 526 |
delete mPythonConsole; |
502 | 527 |
delete mPythonUtils; |
503 | 528 | |
... | ... | |
602 | 627 |
mActionExit->setMenuRole( QAction::QuitRole ); // put in Application menu on Mac OS X |
603 | 628 |
connect( mActionExit, SIGNAL( triggered() ), this, SLOT( fileExit() ) ); |
604 | 629 | |
630 |
#ifdef HAVE_TABS |
|
631 |
mActionAddTabDialog = new QAction( getThemeIcon( "mActionAddTabDialog.png" ), tr( "New &Tab" ), this ); |
|
632 |
shortcuts->registerAction( mActionAddTabDialog, tr( "Ctrl+T", "New Tab" ) ); |
|
633 |
// mActionNewCanvas->setShortcut( QKeySequence::AddTab ); |
|
634 |
mActionAddTabDialog->setStatusTip( tr( "New Tab" ) ); |
|
635 |
connect( mActionAddTabDialog, SIGNAL( triggered() ), this, SLOT(addTabDialog()) ); |
|
636 | ||
637 |
mActionCanvasTab = new QAction( getThemeIcon( "mActionCanvasTab.png" ), tr( "New &canvas" ), this ); |
|
638 |
// shortcuts->registerAction( mActionCanvasTab, tr( "Ctrl+T", "New Canvas" ) ); |
|
639 |
// mActionNewCanvas->setShortcut( QKeySequence::AddTab ); |
|
640 |
mActionCanvasTab->setStatusTip( tr( "New canvas" ) ); |
|
641 |
connect( mActionCanvasTab, SIGNAL( triggered() ), this, SLOT(addCanvasTab()) ); |
|
642 | ||
643 |
mActionCloseTab = new QAction( getThemeIcon( "mActionCloseTab.png" ), tr( "&Close Tab" ), this ); |
|
644 |
shortcuts->registerAction( mActionCloseTab, tr( "Ctrl+W", "Close Tab" ) ); |
|
645 |
// mActionCloseTab->setShortcut( QKeySequence::Close ); |
|
646 |
mActionCloseTab->setStatusTip( tr( "Close Tab" ) ); |
|
647 |
connect( mActionCloseTab, SIGNAL( triggered() ), this, SLOT(closeTab()) ); |
|
648 | ||
649 |
mActionRestoreTab = new QAction( getThemeIcon( "mActionRestoreTab.png" ), tr( "&Restore Tab" ), this ); |
|
650 |
shortcuts->registerAction( mActionRestoreTab, tr( "Ctrl+Shift+T", "Restore Tab" ) ); |
|
651 |
mActionRestoreTab->setStatusTip( tr( "Restore Tab" ) ); |
|
652 |
mActionRestoreTab->setEnabled( false ); |
|
653 |
connect( mActionRestoreTab, SIGNAL( triggered() ), this, SLOT(restoreTab()) ); |
|
654 | ||
655 |
// create actions that helps user to navigate in tabs |
|
656 |
mActionNextTab = new QAction(this); |
|
657 |
shortcuts->registerAction( mActionNextTab, tr( "Ctrl+Tab", "Goto next tab" ) ); |
|
658 |
mActionNextTab->setShortcut(QKeySequence::NextChild); |
|
659 |
connect(mActionNextTab, SIGNAL(triggered()), this, SLOT(nextTab())); |
|
660 |
addAction(mActionNextTab); |
|
661 | ||
662 |
mActionPreviousTab = new QAction(this); |
|
663 |
shortcuts->registerAction( mActionPreviousTab, tr( "Ctrl+Shift+Tab", "Goto previous tab" ) ); |
|
664 |
// mActionPreviousTab->setShortcut(QKeySequence::PreviousChild); |
|
665 |
connect(mActionPreviousTab, SIGNAL(triggered()), this, SLOT(previousTab())); |
|
666 |
addAction(mActionPreviousTab); |
|
667 |
#endif |
|
605 | 668 |
// Edit Menu Items |
606 | 669 | |
607 | 670 |
#if 0 |
... | ... | |
1149 | 1212 | |
1150 | 1213 |
mFileMenu->addAction( mActionNewProject ); |
1151 | 1214 |
mFileMenu->addAction( mActionOpenProject ); |
1215 |
#ifdef HAVE_TABS |
|
1216 |
mFileMenu->addAction( mActionAddTabDialog ); |
|
1217 |
mFileMenu->addAction( mActionCanvasTab ); |
|
1218 |
#endif |
|
1152 | 1219 |
mRecentProjectsMenu = mFileMenu->addMenu( tr( "&Open Recent Projects" ) ); |
1153 | 1220 |
// Connect once for the entire submenu. |
1154 | 1221 |
connect( mRecentProjectsMenu, SIGNAL( triggered( QAction * ) ), |
... | ... | |
1170 | 1237 |
mPrintComposersMenu = mFileMenu->addMenu( tr( "Print Composers" ) ); |
1171 | 1238 |
mActionFileSeparator4 = mFileMenu->addSeparator(); |
1172 | 1239 | |
1240 |
#ifdef HAVE_TABS |
|
1241 |
mFileMenu->addAction( mActionRestoreTab ); |
|
1242 |
mFileMenu->addAction( mActionCloseTab ); |
|
1243 |
#endif |
|
1173 | 1244 |
mFileMenu->addAction( mActionExit ); |
1174 | 1245 | |
1175 | 1246 |
// Edit Menu |
... | ... | |
1469 | 1540 |
mToolbarMenu->addAction( mHelpToolBar->toggleViewAction() ); |
1470 | 1541 |
} |
1471 | 1542 | |
1543 |
#ifndef HAVE_TABS |
|
1472 | 1544 |
void QgisApp::createStatusBar() |
1473 | 1545 |
{ |
1474 | 1546 |
// |
... | ... | |
1600 | 1672 |
statusBar()->addPermanentWidget( mOnTheFlyProjectionStatusButton, 0 ); |
1601 | 1673 |
statusBar()->showMessage( tr( "Ready" ) ); |
1602 | 1674 |
} |
1675 |
#endif |
|
1603 | 1676 | |
1604 | 1677 | |
1605 | 1678 |
void QgisApp::setTheme( QString theThemeName ) |
... | ... | |
1627 | 1700 |
QgsApplication::setThemeName( theThemeName ); |
1628 | 1701 |
//QgsDebugMsg("Setting theme to \n" + theThemeName); |
1629 | 1702 |
mActionNewProject->setIcon( getThemeIcon( "/mActionFileNew.png" ) ); |
1703 |
#ifdef HAVE_TABS |
|
1704 |
mActionCanvasTab->setIcon( getThemeIcon( "/mActionCanvasTab.png" ) ); |
|
1705 |
#endif |
|
1630 | 1706 |
mActionOpenProject->setIcon( getThemeIcon( "/mActionFileOpen.png" ) ); |
1631 | 1707 |
mActionSaveProject->setIcon( getThemeIcon( "/mActionFileSave.png" ) ); |
1632 | 1708 |
mActionSaveProjectAs->setIcon( getThemeIcon( "/mActionFileSaveAs.png" ) ); |
1633 | 1709 |
mActionNewPrintComposer->setIcon( getThemeIcon( "/mActionNewComposer.png" ) ); |
1634 | 1710 |
mActionSaveMapAsImage->setIcon( getThemeIcon( "/mActionSaveMapAsImage.png" ) ); |
1711 |
#ifdef HAVE_TABS |
|
1712 |
mActionCloseTab->setIcon( getThemeIcon( "/mActionCloseTab.png" ) ); |
|
1713 |
#endif |
|
1635 | 1714 |
mActionExit->setIcon( getThemeIcon( "/mActionFileExit.png" ) ); |
1636 | 1715 |
mActionAddOgrLayer->setIcon( getThemeIcon( "/mActionAddOgrLayer.png" ) ); |
1637 | 1716 |
mActionAddRasterLayer->setIcon( getThemeIcon( "/mActionAddRasterLayer.png" ) ); |
... | ... | |
1710 | 1789 |
{ |
1711 | 1790 |
// connect the "cleanup" slot |
1712 | 1791 |
connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( saveWindowState() ) ); |
1792 |
#ifndef HAVE_TABS |
|
1713 | 1793 |
//connect the legend, mapcanvas and overview canvas to the registry |
1714 | 1794 | |
1715 | 1795 |
// connect map layer registry signals to legend |