×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Nov 2011
    Location
    Coimbatore
    Posts
    87

    How to use splash screen at loading an app for more than 5 sec?

    Hi All,
    I am new to Qt,i am in need of having a splash screen for the login page, where it should be loading for 5 sec and i had seen these forum given below and could not find an exact solution to that one.

    I am able to bring the splash screen for 1 sec, but it should be loading for atleast 5 sec with different states and timer for it.

    Is there any timer to be given and if there is any sample coding that might help to get through and develop my codings will be much more helpful.

    This is the site which i referred:
    http://www.developer.nokia.com/Commu...h_screen_in_Qt

    Thanks and regards if any one gets me an solution for it.
    Naufal.A

  2. #2
    Registered User
    Join Date
    Dec 2009
    Location
    Switzerland
    Posts
    121

    Re: How to use splash screen at loading an app for more than 5 sec?

    Use QTimer.

    You can write something like this in your MainWindow constructor:

    Code:
    MainWindow::MainWindow(QWidget *parent)
    {
    ...
    QTimer::singleShot(5000, this, SLOT(updateCaption()));    
    ...
    }
    void MainWindow::updateCaption(void)
    {
      // 5 seconds after the app was loaded
    }
    Tiger54
    I discovered Qt in the summer 2010, it was sooo easy and nice to use, that I begun to write some apps.
    Thank you Nokia, for giving me this possibility!

  3. #3
    Regular Contributor
    Join Date
    Nov 2011
    Location
    Coimbatore
    Posts
    87

    Re: How to use splash screen at loading an app for more than 5 sec?

    Hi Tiger54,
    I got the desired result which you had said !!!!
    Thanks a lott for your reply..

    Regards,
    Naufal.A

  4. #4
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: How to use splash screen at loading an app for more than 5 sec?

    Sorry to break the party, but why dont you allow the app to start faster on a faster system. The code for this would be like this:
    Code:
    int main(int argc, char *argv[])
    {
        QMyApplication a(argc, argv);
        
        QPixmap pixmap(":/backgrounds/rsc/logo.bmp");
        
        int csize;
        
        isFullyUp=false;
    
        QMainWindow *testForm=new QMainWindow();
        //Get size
        testForm->showFullScreen();
        hsize=testForm->height();
        wsize=testForm->width();
        qDebug() << hsize << wsize;
        testForm->close();
        delete testForm;
        
    
    
           qt_OfferIapDialog();
    
    
        myAdModule=new InnerActiveAdModule(&a,"Tamoggemon_TypeGun_OVI",120);
        myAdObserver=new QAdObserver(myAdModule, &a);
    
        QObject::connect(myAdModule, SIGNAL(startReloadAd()), myAdObserver, SLOT(startReloadAd()));
        QObject::connect(myAdModule, SIGNAL(adDataReady()), myAdObserver, SLOT(adDataReady()));
        QObject::connect(myAdModule, SIGNAL(adDataCorrupted()), myAdObserver, SLOT(adDataCorrupted()));
        QObject::connect(myAdModule, SIGNAL(networkError(const QString&)), myAdObserver, SLOT(networkError(const QString&)));
    
        //myAdModule->setAdProtocolParameter(EIaProtocolParams_Category, "Game");
        myAdModule->setAdProtocolParameter(EIaProtocolParams_DistributionChannelPortal, "551");
        int alpha=myAdModule->requestAd();
        alpha=alpha;
        /*myAdModule->setAdProtocolParameter(EIaProtocolParams_ExternalId, strEid);
        myAdModule->setAdProtocolParameter(EIaProtocolParams_Age, strAge);
        myAdModule->setAdProtocolParameter(EIaProtocolParams_Gender, strGender);
        myAdModule->setAdProtocolParameter(EIaProtocolParams_MobileNumber, strMobileNumber);
    
        myAdModule->setAdProtocolParameter(EIaProtocolParams_Keywords, strKeywords);
        myAdModule->setAdProtocolParameter(EIaProtocolParams_LocationString, strLocation);
        myAdModule->setAdProtocolParameter(EIaProtocolParams_LocationGps, strLocationGps);*/
    
    
        if(wsize<hsize)
        {
        	csize=wsize;
        	wsize=hsize;
        	hsize=csize;
        }
        
        QSplashScreen *splash = new QSplashScreen(pixmap);
        splash->showNormal();
        qDebug() << splash->maximumSize();
        
        splash->showMessage(QObject::tr("Starting up..."));
        prefs.initPrefs();
    	globSoundMixer=CSoundMixerContainer::NewL();
    	globSoundMixer->StartMixer();
        qApp->processEvents();
        
        splash->showMessage(QObject::tr("Loading images..."));
        if(wsize==640 && hsize==360)
        {
        	qDebug("nHD");
        	levels[0]=new QPixmap(":/backgrounds/rsc/0.jpg");
        	levels[1]=new QPixmap(":/backgrounds/rsc/1.jpg");
        	levels[2]=new QPixmap(":/backgrounds/rsc/2.jpg");
        	levels[3]=new QPixmap(":/backgrounds/rsc/3.jpg");
        	levels[4]=new QPixmap(":/backgrounds/rsc/4.jpg");
        	levels[5]=new QPixmap(":/backgrounds/rsc/5.jpg");
        	levels[6]=new QPixmap(":/backgrounds/rsc/6.jpg");
        	levels[7]=new QPixmap(":/backgrounds/rsc/7.jpg");
        	levels[8]=new QPixmap(":/backgrounds/rsc/8.jpg");
        	levels[9]=new QPixmap(":/backgrounds/rsc/9.jpg");
        	levels[10]=new QPixmap(":/backgrounds/rsc/10.jpg");
        	halNewRandCharMax=620;
        	halMaxYForChar=320;
        	halLifeRectY1=345;
        	halLifeRectX2=639;
        	halLifeRectY2=359;
        	halLifeRectFillY1=346;
        	halLifeRectFillX2=638;
        	halLifeRectFillY2=358;
        }
        else if (wsize==640 && hsize==480)
        {
        	qDebug("VGA");
        	levels[0]=new QPixmap(":/backgrounds/rsc/vga/0.jpg");
        	levels[1]=new QPixmap(":/backgrounds/rsc/vga/1.jpg");
        	levels[2]=new QPixmap(":/backgrounds/rsc/vga/2.jpg");
        	levels[3]=new QPixmap(":/backgrounds/rsc/vga/3.jpg");
        	levels[4]=new QPixmap(":/backgrounds/rsc/vga/4.jpg");
        	levels[5]=new QPixmap(":/backgrounds/rsc/vga/5.jpg");
        	levels[6]=new QPixmap(":/backgrounds/rsc/vga/6.jpg");
        	levels[7]=new QPixmap(":/backgrounds/rsc/vga/7.jpg");
        	levels[8]=new QPixmap(":/backgrounds/rsc/vga/8.jpg");
        	levels[9]=new QPixmap(":/backgrounds/rsc/vga/9.jpg");
        	levels[10]=new QPixmap(":/backgrounds/rsc/vga/10.jpg");
        	halNewRandCharMax=620;
        	halMaxYForChar=440;
        	halLifeRectY1=345+120;
        	halLifeRectX2=639;
        	halLifeRectY2=359+120;
        	halLifeRectFillY1=346+120;
        	halLifeRectFillX2=638;
        	halLifeRectFillY2=358+120;
        }
        else if (wsize==320 && hsize==240)
        {
        	qDebug("QVGA");
        	levels[0]=new QPixmap(":/backgrounds/rsc/qvga/0.jpg");
        	levels[1]=new QPixmap(":/backgrounds/rsc/qvga/1.jpg");
        	levels[2]=new QPixmap(":/backgrounds/rsc/qvga/2.jpg");
        	levels[3]=new QPixmap(":/backgrounds/rsc/qvga/3.jpg");
        	levels[4]=new QPixmap(":/backgrounds/rsc/qvga/4.jpg");
        	levels[5]=new QPixmap(":/backgrounds/rsc/qvga/5.jpg");
        	levels[6]=new QPixmap(":/backgrounds/rsc/qvga/6.jpg");
        	levels[7]=new QPixmap(":/backgrounds/rsc/qvga/7.jpg");
        	levels[8]=new QPixmap(":/backgrounds/rsc/qvga/8.jpg");
        	levels[9]=new QPixmap(":/backgrounds/rsc/qvga/9.jpg");
        	levels[10]=new QPixmap(":/backgrounds/rsc/qvga/10.jpg");
        	halNewRandCharMax=300;
        	halMaxYForChar=200;
        	halLifeRectY1=225;
        	halLifeRectX2=319;
        	halLifeRectY2=239;
        	halLifeRectFillY1=226;
        	halLifeRectFillX2=318;
        	halLifeRectFillY2=238;
        }
        qApp->processEvents();
    
        splash->showMessage(QObject::tr("Loading orbs..."));
    	orbs[0]=new QPixmap(":/orbs/rsc/yelloworb.bmp");
    	orbs[0]->setMask(orbs[0]->createMaskFromColor(QColor(255,255,255)));
    	orbs[1]=new QPixmap(":/orbs/rsc/pinkorb.bmp");
    	orbs[1]->setMask(orbs[1]->createMaskFromColor(QColor(0,0,0)));
    	orbs[2]=new QPixmap(":/orbs/rsc/blkorb.bmp");
    	orbs[2]->setMask(orbs[2]->createMaskFromColor(QColor(255,255,255)));
    	orbs[3]=new QPixmap(":/orbs/rsc/blueorb.bmp");
    	orbs[3]->setMask(orbs[3]->createMaskFromColor(QColor(255,255,255)));
    	orbs[4]=new QPixmap(":/orbs/rsc/orangeorb.bmp");
    	orbs[4]->setMask(orbs[4]->createMaskFromColor(QColor(255,255,255)));
    	orbs[5]=new QPixmap(":/orbs/rsc/greyorb.bmp");
    	orbs[5]->setMask(orbs[5]->createMaskFromColor(QColor(0,0,0)));
        qApp->processEvents();
    
        splash->showMessage(QObject::tr("Almost there..."));
    	foreground[0]=foreground[0].fromRgb(105,105,105);
    	fade1[0]=fade1[0].fromRgb(105,105,105);
    	fade2[0]=fade2[0].fromRgb(105,105,105);
    	fade3[0]=fade3[0].fromRgb(105,105,105);
    	fade4[0]=fade4[0].fromRgb(105,105,105);
    	background[0]=background[0].fromRgb(0,0,0);
    	whichOrb[0]=0;
    
    	foreground[1]=foreground[1].fromRgb(105,105,105);
    	fade1[1]=fade1[1].fromRgb(105,105,105);
    	fade2[1]=fade2[1].fromRgb(105,105,105);
    	fade3[1]=fade3[1].fromRgb(105,105,105);
    	fade4[1]=fade4[1].fromRgb(105,105,105);
    	background[1]=background[1].fromRgb(0,0,0);
    	whichOrb[1]=1;
    	whichOrb[1]=1;
    	
    	foreground[2]=foreground[2].fromRgb(105,105,105);
    	fade1[2]=fade1[2].fromRgb(105,105,105);
    	fade2[2]=fade2[2].fromRgb(105,105,105);
    	fade3[2]=fade3[2].fromRgb(105,105,105);
    	fade4[2]=fade4[2].fromRgb(105,105,105);
    	background[2]=background[2].fromRgb(0,0,0);
    	whichOrb[2]=2;
    	
    	foreground[3]=foreground[3].fromRgb(105,105,105);
    	fade1[3]=fade1[3].fromRgb(105,105,105);
    	fade2[3]=fade2[3].fromRgb(105,105,105);
    	fade3[3]=fade3[3].fromRgb(105,105,105);
    	fade4[3]=fade4[3].fromRgb(105,105,105);
    	background[3]=background[3].fromRgb(0,0,0);
    	whichOrb[3]=3;
    	
    	foreground[4]=foreground[4].fromRgb(105,105,105);
    	fade1[4]=fade1[4].fromRgb(105,105,105);
    	fade2[4]=fade2[4].fromRgb(105,105,105);
    	fade3[4]=fade3[4].fromRgb(105,105,105);
    	fade4[4]=fade4[4].fromRgb(105,105,105);
    	background[4]=background[4].fromRgb(0,0,0);
    	whichOrb[4]=4;
    	
    	foreground[5]=foreground[5].fromRgb(105,105,105);
    	fade1[5]=fade1[5].fromRgb(105,105,105);
    	fade2[5]=fade2[5].fromRgb(105,105,105);
    	fade3[5]=fade3[5].fromRgb(105,105,105);
    	fade4[5]=fade4[5].fromRgb(105,105,105);
    	background[5]=background[5].fromRgb(0,0,0);
    	whichOrb[5]=5;
    	
    	foreground[6]=foreground[6].fromRgb(105,105,105);
    	fade1[6]=fade1[6].fromRgb(105,105,105);
    	fade2[6]=fade2[6].fromRgb(105,105,105);
    	fade3[6]=fade3[6].fromRgb(105,105,105);
    	fade4[6]=fade4[6].fromRgb(105,105,105);
    	background[6]=background[6].fromRgb(0,0,0);
    	whichOrb[6]=1;
    	
    	foreground[7]=foreground[7].fromRgb(105,105,105);
    	fade1[7]=fade1[7].fromRgb(105,105,105);
    	fade2[7]=fade2[7].fromRgb(105,105,105);
    	fade3[7]=fade3[7].fromRgb(105,105,105);
    	fade4[7]=fade4[7].fromRgb(105,105,105);
    	background[7]=background[7].fromRgb(0,0,0);
    	whichOrb[7]=4;
    	
    	foreground[8]=foreground[8].fromRgb(105,105,105);
    	fade1[8]=fade1[8].fromRgb(105,105,105);
    	fade2[8]=fade2[8].fromRgb(105,105,105);
    	fade3[8]=fade3[8].fromRgb(105,105,105);
    	fade4[8]=fade4[8].fromRgb(105,105,105);
    	background[8]=background[8].fromRgb(0,0,0);
    	whichOrb[8]=1;
    	
    	foreground[9]=foreground[9].fromRgb(105,105,105);
    	fade1[9]=fade1[9].fromRgb(105,105,105);
    	fade2[9]=fade2[9].fromRgb(105,105,105);
    	fade3[9]=fade3[9].fromRgb(105,105,105);
    	fade4[9]=fade4[9].fromRgb(105,105,105);
    	background[9]=background[9].fromRgb(0,0,0);
    	whichOrb[9]=2;
    	
    	foreground[10]=foreground[10].fromRgb(105,105,105);
    	fade1[10]=fade1[10].fromRgb(105,105,105);
    	fade2[10]=fade2[10].fromRgb(105,105,105);
    	fade3[10]=fade3[10].fromRgb(105,105,105);
    	fade4[10]=fade4[10].fromRgb(105,105,105);
    	background[10]=background[10].fromRgb(0,0,0);
    	whichOrb[10]=4;
    	
    	//unneeded
    	foreground[11]=foreground[11].fromRgb(105,105,105);
    	fade1[11]=fade1[11].fromRgb(105,105,105);
    	fade2[11]=fade2[11].fromRgb(105,105,105);
    	fade3[11]=fade3[11].fromRgb(105,105,105);
    	fade4[11]=fade4[11].fromRgb(105,105,105);
    	background[11]=background[11].fromRgb(0,0,0);
    	whichOrb[11]=0;
        qApp->processEvents();
    
        QtTypeGun w;
        w.showFullScreen();
        
        splash->finish(&w);
        return a.exec();
    }
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

  5. #5
    Regular Contributor
    Join Date
    Nov 2011
    Location
    Coimbatore
    Posts
    87

    Re: How to use splash screen at loading an app for more than 5 sec?

    Hi Tamhanna,
    Thank you for your reply and codings.. I will check the code with my advanced user and try it out.

    Again thanks a lot and regards,
    Naufal.A

Similar Threads

  1. Splash Screen loading problem
    By Mozart2007 in forum Symbian
    Replies: 4
    Last Post: 2009-09-23, 08:59
  2. splash screen is not loading.
    By manojkumar.m in forum Symbian
    Replies: 2
    Last Post: 2008-11-11, 12:57
  3. Splash screen loading problem
    By manojkumar.m in forum Symbian
    Replies: 15
    Last Post: 2008-11-11, 10:20
  4. Shows splash screen when loading.
    By fishman8 in forum Symbian User Interface
    Replies: 7
    Last Post: 2008-04-04, 19:17
  5. Loading/splash screen REFUSES to show
    By Larry101 in forum Mobile Java General
    Replies: 3
    Last Post: 2006-10-10, 12:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×