~ubuntu-branches/ubuntu/karmic/rosegarden/karmic

« back to all changes in this revision

Viewing changes to src/gui/application/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2008-05-02 00:33:44 UTC
  • mfrom: (1.1.7 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080502003344-67vbfhgqx2yl0ksi
Tags: 1:1.7.0-1ubuntu1
* Merge from Debian unstable. (LP: #225849) Remaining Ubuntu changes:
  - Add usr/share/doc/kde/HTML to rosegarden-data, to provide online
    help documentation.
  - Change fftw3-dev to libfftw3-dev.
  - Update maintainer field as per spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
    Rosegarden
5
5
    A sequencer and musical notation editor.
6
6
 
7
 
    This program is Copyright 2000-2007
 
7
    This program is Copyright 2000-2008
8
8
        Guillaume Laurent   <glaurent@telegraph-road.org>,
9
9
        Chris Cannam        <cannam@all-day-breakfast.com>,
10
10
        Richard Bown        <bownie@bownie.com>
35
35
#include <kprocess.h>
36
36
#include <kglobalsettings.h>
37
37
 
 
38
#include <qstringlist.h>
 
39
#include <qregexp.h>
 
40
#include <qvbox.h>
 
41
#include <qlabel.h>
 
42
 
38
43
#include "document/ConfigGroups.h"
39
44
#include "misc/Strings.h"
40
45
#include "misc/Debug.h"
41
46
#include "gui/application/RosegardenGUIApp.h"
 
47
#include "gui/widgets/CurrentProgressDialog.h"
42
48
#include "document/RosegardenGUIDoc.h"
43
49
#include "gui/kdeext/KStartupLogo.h"
44
50
 
351
357
            QString s = text.readLine().stripWhiteSpace();
352
358
            versionFile.close();
353
359
            if (s) {
354
 
                if (s == VERSION)
355
 
                    return ;
 
360
                if (s == VERSION) return;
356
361
                installedVersion = s;
357
362
            }
358
363
        }
408
413
 
409
414
    KAboutData aboutData( "rosegarden", I18N_NOOP("Rosegarden"),
410
415
                          VERSION, description, KAboutData::License_GPL,
411
 
                          I18N_NOOP("Copyright 2000 - 2007 Guillaume Laurent, Chris Cannam, Richard Bown\nParts copyright 1994 - 2004 Chris Cannam, Andy Green, Richard Bown, Guillaume Laurent\nLilypond fonts copyright 1997 - 2005 Han-Wen Nienhuys and Jan Nieuwenhuizen"),
 
416
                          I18N_NOOP("Copyright 2000 - 2008 Guillaume Laurent, Chris Cannam, Richard Bown\nParts copyright 1994 - 2004 Chris Cannam, Andy Green, Richard Bown, Guillaume Laurent\nLilyPond fonts copyright 1997 - 2005 Han-Wen Nienhuys and Jan Nieuwenhuizen"),
412
417
                          0,
413
418
                          "http://www.rosegardenmusic.com/",
414
419
                          "rosegarden-devel@lists.sourceforge.net");
421
426
    aboutData.addAuthor("Heikki Johannes Junes", 0, "hjunes@users.sourceforge.net");
422
427
 
423
428
    aboutData.addCredit("Randall Farmer", I18N_NOOP("Chord labelling code"), " rfarme@simons-rock.edu");
424
 
    aboutData.addCredit("Hans  Kieserman", I18N_NOOP("Lilypond output\nassorted other patches\ni18n-ization"), "hkieserman@mail.com");
 
429
    aboutData.addCredit("Hans  Kieserman", I18N_NOOP("LilyPond output\nassorted other patches\ni18n-ization"), "hkieserman@mail.com");
425
430
    aboutData.addCredit("Levi Burton", I18N_NOOP("UI improvements\nbug fixes"), "donburton@sbcglobal.net");
426
431
    aboutData.addCredit("Mark Hymers", I18N_NOOP("Segment colours\nOther UI and bug fixes"), "<markh@linuxfromscratch.org>");
427
432
    aboutData.addCredit("Alexandre Prokoudine", I18N_NOOP("Russian translation\ni18n-ization"), "avp@altlinux.ru");
492
497
 
493
498
    KConfig *config = kapp->config();
494
499
 
 
500
    config->setGroup(GeneralOptionsConfigGroup);
 
501
    QString lastVersion = config->readEntry("lastversion", "");
 
502
    bool newVersion = (lastVersion != VERSION);
 
503
    if (newVersion) {
 
504
        std::cerr << "*** This is the first time running this Rosegarden version" << std::endl;
 
505
        config->writeEntry("lastversion", VERSION);
 
506
    }
 
507
 
495
508
    // If there is no config setting for the startup window size, set
496
509
    // one now.  But base the default on the appropriate desktop size
497
510
    // (i.e. not the entire desktop, if Xinerama is in use).  This is
504
517
    // under Xinerama).  These are obtained from QDesktopWidget.
505
518
 
506
519
    config->setGroup("MainView");
 
520
    int windowWidth = 0, windowHeight = 0;
507
521
 
508
522
    QDesktopWidget *desktop = KApplication::desktop();
509
523
    if (desktop) {
510
 
        QRect totalRect(desktop->availableGeometry());
 
524
        QRect totalRect(desktop->screenGeometry());
511
525
        QRect desktopRect = KGlobalSettings::desktopGeometry(QPoint(0, 0));
512
526
        QSize startupSize;
513
527
        if (desktopRect.height() <= 800) {
519
533
        }
520
534
        QString widthKey = QString("Width %1").arg(totalRect.width());
521
535
        QString heightKey = QString("Height %1").arg(totalRect.height());
522
 
        if (!config->hasKey(widthKey)) {
523
 
            config->writeEntry(widthKey, startupSize.width());
524
 
        }
525
 
        if (!config->hasKey(heightKey)) {
526
 
            config->writeEntry(heightKey, startupSize.height());
527
 
        }
 
536
        windowWidth = config->readUnsignedNumEntry
 
537
            (widthKey, startupSize.width());
 
538
        windowHeight = config->readUnsignedNumEntry
 
539
            (heightKey, startupSize.height());
528
540
    }
529
541
 
530
542
    config->setGroup("KDE Action Restrictions");
548
560
    if (config->readBoolEntry("Logo", true) && (!kapp->isRestored() && args->isSet("splash")) ) {
549
561
        RG_DEBUG << k_funcinfo << "Showing startup logo\n";
550
562
        startLogo = KStartupLogo::getInstance();
 
563
        startLogo->setShowTip(!newVersion);
551
564
        startLogo->show();
552
565
    }
553
566
 
584
597
                                             args->isSet("existingsequencer"),
585
598
                                             startLogo);
586
599
 
 
600
        rosegardengui->setIsFirstRun(newVersion);
 
601
 
587
602
        app.setMainWidget(rosegardengui);
588
603
 
 
604
        if (windowWidth != 0 && windowHeight != 0) {
 
605
            rosegardengui->resize(windowWidth, windowHeight);
 
606
        }
 
607
 
589
608
        rosegardengui->show();
590
609
 
591
610
        // raise start logo
629
648
        RG_DEBUG << "RosegardenGUI - " << e.getMessage() << endl;
630
649
    }
631
650
 
632
 
    if (startLogo) {
633
 
 
634
 
        // pause to ensure the logo has been visible for a reasonable
635
 
        // length of time, just 'cos it looks a bit silly to show it
636
 
        // and remove it immediately
637
 
 
638
 
        struct timeval now;
639
 
        gettimeofday(&now, 0);
640
 
 
641
 
        RealTime visibleFor =
642
 
            RealTime(now.tv_sec, now.tv_usec * 1000) -
643
 
            RealTime(logoShowTime.tv_sec, logoShowTime.tv_usec * 1000);
644
 
 
645
 
        if (visibleFor < RealTime(2, 0)) {
646
 
            int waitTime = visibleFor.sec * 1000 + visibleFor.msec();
647
 
            QTimer::singleShot(2500 - waitTime, startLogo, SLOT(close()));
648
 
        } else {
649
 
            startLogo->close();
650
 
        }
651
 
 
652
 
    } else {
653
 
 
654
 
        // if the start logo is there, it's responsible for showing this;
655
 
        // otherwise we have to
656
 
 
657
 
        RG_DEBUG << "main: Showing Tips\n";
658
 
        KTipDialog::showTip(locate("data", "rosegarden/tips"));
659
 
    }
660
 
 
661
651
 
662
652
    config->setGroup(SequencerOptionsConfigGroup);
663
653
 
690
680
    XSetErrorHandler( _x_errhandler );
691
681
#endif
692
682
 
 
683
    if (startLogo) {
 
684
 
 
685
        // pause to ensure the logo has been visible for a reasonable
 
686
        // length of time, just 'cos it looks a bit silly to show it
 
687
        // and remove it immediately
 
688
 
 
689
        struct timeval now;
 
690
        gettimeofday(&now, 0);
 
691
 
 
692
        RealTime visibleFor =
 
693
            RealTime(now.tv_sec, now.tv_usec * 1000) -
 
694
            RealTime(logoShowTime.tv_sec, logoShowTime.tv_usec * 1000);
 
695
 
 
696
        if (visibleFor < RealTime(2, 0)) {
 
697
            int waitTime = visibleFor.sec * 1000 + visibleFor.msec();
 
698
            QTimer::singleShot(2500 - waitTime, startLogo, SLOT(close()));
 
699
        } else {
 
700
            startLogo->close();
 
701
        }
 
702
 
 
703
    } else {
 
704
 
 
705
        // if the start logo is there, it's responsible for showing this;
 
706
        // otherwise we have to
 
707
 
 
708
        if (!newVersion) {
 
709
            RosegardenGUIApp::self()->awaitDialogClearance();
 
710
            KTipDialog::showTip(locate("data", "rosegarden/tips"));
 
711
        }
 
712
    }
 
713
 
 
714
    if (newVersion) {
 
715
        KStartupLogo::hideIfStillThere();
 
716
        CurrentProgressDialog::freeze();
 
717
 
 
718
        KDialogBase *dialog = new KDialogBase(rosegardengui, "welcome",
 
719
                                              true, i18n("Welcome!"),
 
720
                                              KDialogBase::Ok,
 
721
                                              KDialogBase::Ok, false);
 
722
        QVBox *mw = dialog->makeVBoxMainWidget();
 
723
        QHBox *hb = new QHBox(mw);
 
724
        QLabel *image = new QLabel(hb);
 
725
        image->setAlignment(Qt::AlignTop);
 
726
        QString iconFile = locate("appdata", "pixmaps/misc/welcome-icon.png");
 
727
        if (iconFile) {
 
728
            image->setPixmap(QPixmap(iconFile));
 
729
        }
 
730
        QLabel *label = new QLabel(hb);
 
731
        label->setText(i18n("<h2>Welcome to Rosegarden!</h2><p>Welcome to the Rosegarden audio and MIDI sequencer and musical notation editor.</p><ul><li>If you have not already done so, you may wish to install some DSSI synth plugins, or a separate synth program such as QSynth.  Rosegarden does not synthesize sounds from MIDI on its own, so without these you will hear nothing.</li><br><br><li>Rosegarden uses the JACK audio server for recording and playback of audio, and for playback from DSSI synth plugins.  These features will only be available if the JACK server is running.</li><br><br><li>Rosegarden has comprehensive documentation: see the Help menu for the handbook, tutorials, and other information!</li></ul><p>Rosegarden was brought to you by a team of volunteers across the world.  To learn more, go to <a href=\"http://www.rosegardenmusic.com/\">http://www.rosegardenmusic.com/</a>.</p>"));
 
732
        dialog->showButtonOK(true);
 
733
        rosegardengui->awaitDialogClearance();
 
734
        dialog->exec();
 
735
 
 
736
        CurrentProgressDialog::thaw();
 
737
    }
 
738
 
693
739
    return kapp->exec();
694
740
}
695
741