More work to get --snapshot command line parameter working properly. Still need to resolve issue with unwanted splashscreen.

git-svn-id: http://svn.osgeo.org/qgis/trunk@969 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2004-02-29 23:11:49 +00:00
parent 24bb981c5a
commit f4bde67073
3 changed files with 17 additions and 9 deletions

View File

@ -32,11 +32,11 @@ email : sherman at mrcc.com
#include "qgisapp.h"
#include <qstringlist.h>
#include <splashscreen.h>
static const char * const ident_ = "$Id$";
/** print usage text
*/
void usage( std::string const & appName )
@ -205,6 +205,9 @@ int main(int argc, char *argv[])
//a.setStyle("Windows");
QgisApp *qgis = new QgisApp();
//
// Now we can instantiate the splashscreen global that is declared in qgisapp.h
//
a.setMainWidget(qgis);
@ -251,7 +254,9 @@ int main(int argc, char *argv[])
/////////////////////////////////////////////////////////////////////
if(mySnapshotFileName!="")
{
// qgis->show();
QPixmap * myQPixmap = new QPixmap(800,600);
myQPixmap->fill();
qgis->saveMapAsImage(mySnapshotFileName,myQPixmap);
return 1;
}

View File

@ -73,7 +73,6 @@
#include "qgslegend.h"
#include "qgsprojectio.h"
#include "qgsmapserverexport.h"
#include <splashscreen.h>
#ifdef POSTGRESQL
#include "qgsdbsourceselect.h"
@ -221,10 +220,10 @@ static char *identify_cursor[] = {
QgisApp::QgisApp(QWidget * parent, const char *name, WFlags fl):QgisAppBase(parent, name, fl)
{
//
// Set up the splash screen
// Splash screen global is declared in qgisapp.h header
//
SplashScreen *mySplash = new SplashScreen();
mySplash->setStatus(tr("Loading QGIS..."));
gSplashScreen = new SplashScreen(); //this is supposed to be instantiated in main.cpp but we get segfaults...
gSplashScreen->setStatus(tr("Loading QGIS..."));
// register all GDAL and OGR plug-ins
GDALAllRegister();
@ -242,7 +241,7 @@ QgisApp::QgisApp(QWidget * parent, const char *name, WFlags fl):QgisAppBase(pare
QBitmap zoomincurmask;
// zoomincurmask = QBitmap(cursorzoomin_mask);
mySplash->setStatus(tr("Setting up QGIS gui..."));
gSplashScreen->setStatus(tr("Setting up QGIS gui..."));
QGridLayout *FrameLayout = new QGridLayout(frameMain, 1, 2, 4, 6, "mainFrameLayout");
QSplitter *split = new QSplitter(frameMain);
@ -284,7 +283,7 @@ QgisApp::QgisApp(QWidget * parent, const char *name, WFlags fl):QgisAppBase(pare
actionAddLayer->removeFrom(PopupMenu_2);
actionAddLayer->removeFrom(DataToolbar);
#endif
mySplash->setStatus(tr("Loading plugins..."));
gSplashScreen->setStatus(tr("Loading plugins..."));
// store the application dir
appDir = PREFIX;
// Get pointer to the provider registry singleton
@ -300,8 +299,8 @@ QgisApp::QgisApp(QWidget * parent, const char *name, WFlags fl):QgisAppBase(pare
restoreWindowState();
// set the focus to the map canvase
mapCanvas->setFocus();
mySplash->finish(this);
delete mySplash;
gSplashScreen->finish(this);
delete gSplashScreen;
#ifdef QGISDEBUG
std::cout << "Plugins are installed in " << plib << std::endl;
@ -1428,6 +1427,8 @@ void QgisApp::saveMapAsImage(QString theImageFileNameQString, QPixmap * theQPixm
}
else
{
//force the size of the canvase
mapCanvas->resize(theQPixmap->width(), theQPixmap->height());
//save the mapview to the selected file
mapCanvas->saveAsImage(theImageFileNameQString,theQPixmap);
}

View File

@ -38,6 +38,8 @@ class QgsHelpViewer;
#include "qgisappbase.h"
#include "qgisiface.h"
class QgsMapCanvas;
#include "splashscreen.h"
static SplashScreen * gSplashScreen ;
/*! \class QgisApp
* \brief Main window for the Qgis application
*/