From acf699af8244896500e654cccdc8aae7e5b545db Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 31 Jan 2013 21:46:40 -0600 Subject: Rename KStartup for enhanced compatibility with KDE4 --- src/gui/application/RosegardenGUIApp.cpp | 30 ++--- src/gui/application/RosegardenGUIApp.cpp.orig | 30 ++--- src/gui/application/main.cpp | 8 +- src/gui/editors/notation/NoteFontFactory.cpp | 8 +- src/gui/editors/notation/NotePixmapFactory.cpp | 4 +- src/gui/kdeext/KStartupLogo.cpp | 155 ------------------------- src/gui/kdeext/KStartupLogo.h | 71 ----------- src/gui/kdeext/TDEStartupLogo.cpp | 155 +++++++++++++++++++++++++ src/gui/kdeext/TDEStartupLogo.h | 71 +++++++++++ src/gui/seqmanager/SequenceManager.cpp | 10 +- 10 files changed, 271 insertions(+), 271 deletions(-) delete mode 100644 src/gui/kdeext/KStartupLogo.cpp delete mode 100644 src/gui/kdeext/KStartupLogo.h create mode 100644 src/gui/kdeext/TDEStartupLogo.cpp create mode 100644 src/gui/kdeext/TDEStartupLogo.h (limited to 'src/gui') diff --git a/src/gui/application/RosegardenGUIApp.cpp b/src/gui/application/RosegardenGUIApp.cpp index 1cc510c..9afa803 100644 --- a/src/gui/application/RosegardenGUIApp.cpp +++ b/src/gui/application/RosegardenGUIApp.cpp @@ -139,7 +139,7 @@ #include "gui/editors/segment/TriggerSegmentManager.h" #include "gui/editors/tempo/TempoView.h" #include "gui/general/EditViewBase.h" -#include "gui/kdeext/KStartupLogo.h" +#include "gui/kdeext/TDEStartupLogo.h" #include "gui/kdeext/KTmpStatusMsg.h" #include "gui/seqmanager/MidiFilterDialog.h" #include "gui/seqmanager/SequenceManager.h" @@ -312,7 +312,7 @@ RosegardenGUIApp::RosegardenGUIApp(bool useSequencer, // If no connection to JACK // try to launch JACK - if the configuration wants us to. if (!launchJack()) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::error(this, i18n("Attempted to launch JACK audio daemon failed. Audio will be disabled.\nPlease check configuration (Settings -> Configure Rosegarden -> Audio -> Startup)\n and restart.")); } } else { @@ -1441,7 +1441,7 @@ void RosegardenGUIApp::initView() m_seqManager->setLoop(0, 0); stateChanged("have_range", KXMLGUIClient::StateReverse); } catch (TQString s) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); KMessageBox::error(this, s); CurrentProgressDialog::thaw(); @@ -1715,13 +1715,13 @@ RosegardenGUIApp::createDocument(TQString filePath, ImportType importType) if (!info.exists()) { // can happen with command-line arg, so... - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::sorry(this, i18n("File \"%1\" does not exist").arg(filePath)); return 0; } if (info.isDir()) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::sorry(this, i18n("File \"%1\" is actually a directory")); return 0; } @@ -1729,7 +1729,7 @@ RosegardenGUIApp::createDocument(TQString filePath, ImportType importType) TQFile file(filePath); if (!file.open(IO_ReadOnly)) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); TQString errStr = i18n("You do not have read permission for \"%1\"").arg(filePath); @@ -1795,7 +1795,7 @@ RosegardenGUIApp::createDocumentFromRGFile(TQString filePath) // At this point the splash screen may still be there, hide it if // it's the case - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); // It is, so ask the user if he wants to use the autosave file int reply = KMessageBox::questionYesNo(this, @@ -3709,7 +3709,7 @@ void RosegardenGUIApp::importProject(TQString filePath) *proc << "--unpack"; *proc << filePath; - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); proc->start(TDEProcess::Block, TDEProcess::All); if (!proc->normalExit() || proc->exitStatus()) { @@ -3774,7 +3774,7 @@ RosegardenGUIApp::guessTextCodec(std::string text) if (text[c] & 0x80) { CurrentProgressDialog::freeze(); - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); IdentifyTextCodecDialog dialog(0, text); dialog.exec(); @@ -3862,7 +3862,7 @@ RosegardenGUIApp::createDocumentFromMIDIFile(TQString file) MidiFile midiFile(fname, &newDoc->getStudio()); - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); ProgressDialog progressDlg(i18n("Importing MIDI file..."), 200, this); @@ -4021,7 +4021,7 @@ void RosegardenGUIApp::slotMergeRG21() RosegardenGUIDoc* RosegardenGUIApp::createDocumentFromRG21File(TQString file) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); ProgressDialog progressDlg( i18n("Importing Rosegarden 2.1 file..."), 100, this); @@ -4108,7 +4108,7 @@ void RosegardenGUIApp::slotMergeHydrogen() RosegardenGUIDoc* RosegardenGUIApp::createDocumentFromHydrogenFile(TQString file) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); ProgressDialog progressDlg( i18n("Importing Hydrogen file..."), 100, this); @@ -4835,7 +4835,7 @@ void RosegardenGUIApp::slotSequencerExited(TDEProcess*) { RG_DEBUG << "RosegardenGUIApp::slotSequencerExited Sequencer exited\n"; - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); if (m_sequencerCheckedIn) { @@ -6215,7 +6215,7 @@ RosegardenGUIApp::getArmedInstruments() void RosegardenGUIApp::showError(TQString error) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); // This is principally used for return values from DSSI plugin @@ -8037,7 +8037,7 @@ void RosegardenGUIApp::slotNewerVersionAvailable(TQString v) { if (m_firstRun) return; - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); awaitDialogClearance(); KMessageBox::information diff --git a/src/gui/application/RosegardenGUIApp.cpp.orig b/src/gui/application/RosegardenGUIApp.cpp.orig index 4007322..4a009d2 100644 --- a/src/gui/application/RosegardenGUIApp.cpp.orig +++ b/src/gui/application/RosegardenGUIApp.cpp.orig @@ -139,7 +139,7 @@ #include "gui/editors/segment/TriggerSegmentManager.h" #include "gui/editors/tempo/TempoView.h" #include "gui/general/EditViewBase.h" -#include "gui/kdeext/KStartupLogo.h" +#include "gui/kdeext/TDEStartupLogo.h" #include "gui/kdeext/KTmpStatusMsg.h" #include "gui/seqmanager/MidiFilterDialog.h" #include "gui/seqmanager/SequenceManager.h" @@ -312,7 +312,7 @@ RosegardenGUIApp::RosegardenGUIApp(bool useSequencer, // If no connection to JACK // try to launch JACK - if the configuration wants us to. if (!launchJack()) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::error(this, i18n("Attempted to launch JACK audio daemon failed. Audio will be disabled.\nPlease check configuration (Settings -> Configure Rosegarden -> Audio -> Startup)\n and restart.")); } } else { @@ -1441,7 +1441,7 @@ void RosegardenGUIApp::initView() m_seqManager->setLoop(0, 0); stateChanged("have_range", KXMLGUIClient::StateReverse); } catch (TQString s) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); KMessageBox::error(this, s); CurrentProgressDialog::thaw(); @@ -1715,13 +1715,13 @@ RosegardenGUIApp::createDocument(TQString filePath, ImportType importType) if (!info.exists()) { // can happen with command-line arg, so... - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::sorry(this, i18n("File \"%1\" does not exist").arg(filePath)); return 0; } if (info.isDir()) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::sorry(this, i18n("File \"%1\" is actually a directory")); return 0; } @@ -1729,7 +1729,7 @@ RosegardenGUIApp::createDocument(TQString filePath, ImportType importType) TQFile file(filePath); if (!file.open(IO_ReadOnly)) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); TQString errStr = i18n("You do not have read permission for \"%1\"").arg(filePath); @@ -1795,7 +1795,7 @@ RosegardenGUIApp::createDocumentFromRGFile(TQString filePath) // At this point the splash screen may still be there, hide it if // it's the case - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); // It is, so ask the user if he wants to use the autosave file int reply = KMessageBox::questionYesNo(this, @@ -3709,7 +3709,7 @@ void RosegardenGUIApp::importProject(TQString filePath) *proc << "--unpack"; *proc << filePath; - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); proc->start(TDEProcess::Block, TDEProcess::All); if (!proc->normalExit() || proc->exitStatus()) { @@ -3774,7 +3774,7 @@ RosegardenGUIApp::guessTextCodec(std::string text) if (text[c] & 0x80) { CurrentProgressDialog::freeze(); - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); IdentifyTextCodecDialog dialog(0, text); dialog.exec(); @@ -3862,7 +3862,7 @@ RosegardenGUIApp::createDocumentFromMIDIFile(TQString file) MidiFile midiFile(fname, &newDoc->getStudio()); - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); ProgressDialog progressDlg(i18n("Importing MIDI file..."), 200, this); @@ -4021,7 +4021,7 @@ void RosegardenGUIApp::slotMergeRG21() RosegardenGUIDoc* RosegardenGUIApp::createDocumentFromRG21File(TQString file) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); ProgressDialog progressDlg( i18n("Importing Rosegarden 2.1 file..."), 100, this); @@ -4108,7 +4108,7 @@ void RosegardenGUIApp::slotMergeHydrogen() RosegardenGUIDoc* RosegardenGUIApp::createDocumentFromHydrogenFile(TQString file) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); ProgressDialog progressDlg( i18n("Importing Hydrogen file..."), 100, this); @@ -4835,7 +4835,7 @@ void RosegardenGUIApp::slotSequencerExited(TDEProcess*) { RG_DEBUG << "RosegardenGUIApp::slotSequencerExited Sequencer exited\n"; - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); if (m_sequencerCheckedIn) { @@ -6215,7 +6215,7 @@ RosegardenGUIApp::getArmedInstruments() void RosegardenGUIApp::showError(TQString error) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); // This is principally used for return values from DSSI plugin @@ -8007,7 +8007,7 @@ void RosegardenGUIApp::slotNewerVersionAvailable(TQString v) { if (m_firstRun) return; - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); awaitDialogClearance(); KMessageBox::information diff --git a/src/gui/application/main.cpp b/src/gui/application/main.cpp index 538e71b..ec9f867 100644 --- a/src/gui/application/main.cpp +++ b/src/gui/application/main.cpp @@ -47,7 +47,7 @@ #include "gui/application/RosegardenGUIApp.h" #include "gui/widgets/CurrentProgressDialog.h" #include "document/RosegardenGUIDoc.h" -#include "gui/kdeext/KStartupLogo.h" +#include "gui/kdeext/TDEStartupLogo.h" #include "gui/application/RosegardenApplication.h" #include "gui/application/RosegardenDCOP.h" @@ -554,13 +554,13 @@ int main(int argc, char *argv[]) // (c) The KDevelop Development Team // config->setGroup(GeneralOptionsConfigGroup); - KStartupLogo* startLogo = 0L; + TDEStartupLogo* startLogo = 0L; // See if the config wants us to control JACK // if (config->readBoolEntry("Logo", true) && (!kapp->isRestored() && args->isSet("splash")) ) { RG_DEBUG << k_funcinfo << "Showing startup logo\n"; - startLogo = KStartupLogo::getInstance(); + startLogo = TDEStartupLogo::getInstance(); startLogo->setShowTip(!newVersion); startLogo->show(); } @@ -713,7 +713,7 @@ int main(int argc, char *argv[]) } if (newVersion) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); KDialogBase *dialog = new KDialogBase(rosegardengui, "welcome", diff --git a/src/gui/editors/notation/NoteFontFactory.cpp b/src/gui/editors/notation/NoteFontFactory.cpp index 9760734..47855a1 100644 --- a/src/gui/editors/notation/NoteFontFactory.cpp +++ b/src/gui/editors/notation/NoteFontFactory.cpp @@ -32,7 +32,7 @@ #include "misc/Strings.h" #include "document/ConfigGroups.h" #include "base/Exception.h" -#include "gui/kdeext/KStartupLogo.h" +#include "gui/kdeext/TDEStartupLogo.h" #include "NoteFont.h" #include "NoteFontMap.h" #include @@ -95,7 +95,7 @@ NoteFontFactory::getFontNames(bool forceRescan) if (map.ok()) names.append(strtoqstr(map.getName())); } catch (Exception e) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::error(0, strtoqstr(e.getMessage())); throw; } @@ -167,7 +167,7 @@ NoteFontFactory::getFont(std::string fontName, int size) m_fonts[std::pair(fontName, size)] = font; return font; } catch (Exception e) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::error(0, strtoqstr(e.getMessage())); throw; } @@ -198,7 +198,7 @@ NoteFontFactory::getDefaultFontName() defaultFont = *fontNames.begin(); else { TQString message = i18n("Can't obtain a default font -- no fonts found"); - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::error(0, message); throw NoFontsAvailable(qstrtostr(message)); } diff --git a/src/gui/editors/notation/NotePixmapFactory.cpp b/src/gui/editors/notation/NotePixmapFactory.cpp index f34eeaa..b661d88 100644 --- a/src/gui/editors/notation/NotePixmapFactory.cpp +++ b/src/gui/editors/notation/NotePixmapFactory.cpp @@ -43,7 +43,7 @@ #include "gui/general/GUIPalette.h" #include "gui/general/PixmapFunctions.h" #include "gui/general/Spline.h" -#include "gui/kdeext/KStartupLogo.h" +#include "gui/kdeext/TDEStartupLogo.h" #include "NotationStrings.h" #include "NotationView.h" #include "NoteCharacter.h" @@ -192,7 +192,7 @@ NotePixmapFactory::init(std::string fontName, int size) try { m_style = NoteStyleFactory::getStyle(NoteStyleFactory::DefaultStyle); } catch (NoteStyleFactory::StyleUnavailable u) { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); KMessageBox::error(0, i18n(strtoqstr(u.getMessage()).ascii())); throw; } diff --git a/src/gui/kdeext/KStartupLogo.cpp b/src/gui/kdeext/KStartupLogo.cpp deleted file mode 100644 index da473e9..0000000 --- a/src/gui/kdeext/KStartupLogo.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// -*- c-basic-offset: 4 -*- - -/* - Rosegarden - A sequencer and musical notation editor. - - This program is Copyright 2000-2008 - Guillaume Laurent , - Chris Cannam , - Richard Bown - - This file contains code borrowed from KDevelop 2.0 - Copyright (c) The KDevelop Development Team. - - The moral right of the authors to claim authorship of this work - has been asserted. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. See the file - COPYING included with this distribution for more information. -*/ - -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include "KStartupLogo.h" -#include "misc/Debug.h" - -KStartupLogo::KStartupLogo(TQWidget * parent, const char *name) - : TQWidget(parent, name, - WStyle_Customize | - WStyle_Splash - ), - m_readyToHide(false), - m_showTip(true) -{ - TQString pixmapFile = locate("appdata", "pixmaps/splash.png"); - if (!pixmapFile) - return ; - m_pixmap.load(pixmapFile); - setBackgroundPixmap(m_pixmap); - setGeometry(TQApplication::desktop()->width() / 2 - m_pixmap.width() / 2, - TQApplication::desktop()->height() / 2 - m_pixmap.height() / 2, - m_pixmap.width(), m_pixmap.height()); -} - -KStartupLogo::~KStartupLogo() -{ - m_wasClosed = true; - m_instance = 0; -} - -void KStartupLogo::paintEvent(TQPaintEvent*) -{ - // Print version number - TQPainter paint(this); - - TQFont defaultFont; - defaultFont.setPixelSize(12); - paint.setFont(defaultFont); - - TQFontMetrics metrics(defaultFont); - int width = metrics.width(m_statusMessage) + 6; - if (width > 200) - width = 200; - - int y = m_pixmap.height() - 12; - - // grep me: splash color - // TQColor bg(49, 94, 19); // color for 2006 splash - TQColor bg(19, 19, 19); // color for the 2008 splash - paint.setPen(bg); - paint.setBrush(bg); - paint.drawRect(TQRect(m_pixmap.width() - 220, m_pixmap.height() - 43, - 220, (y + 8) - (m_pixmap.height() - 43))); - - // paint.setPen(TQt::black); - // paint.setBrush(TQt::black); - paint.setPen(TQt::white); - paint.setBrush(TQt::white); - - //TQString version(VERSION); - //int sepIdx = version.find("-"); - TQString versionLabel(VERSION); - //TQString("R%1 v%2").arg(version.left(sepIdx)).arg(version.mid(sepIdx + 1)); - int versionWidth = metrics.width(versionLabel); - - paint.drawText(m_pixmap.width() - versionWidth - 18, - m_pixmap.height() - 28, - versionLabel); - - paint.drawText(m_pixmap.width() - (width + 10), y, m_statusMessage); -} - -void KStartupLogo::slotShowStatusMessage(TQString message) -{ - m_statusMessage = message; - paintEvent(0); - TQApplication::flushX(); -} - -void KStartupLogo::close() -{ - if (!m_wasClosed && isVisible()) { - - if (m_showTip) { - RG_DEBUG << "KStartupLogo::close: Showing Tips\n"; - KTipDialog::showTip(locate("data", "rosegarden/tips")); - } - } - - TQWidget::close(); -} - - -void KStartupLogo::mousePressEvent(TQMouseEvent*) -{ - // for the haters of raising startlogos - if (m_readyToHide) - hide(); // don't close, main() sets up a TQTimer for that -} - -KStartupLogo* KStartupLogo::getInstance() -{ - if (m_wasClosed) - return 0; - - if (!m_instance) - m_instance = new KStartupLogo; - - return m_instance; -} - -void KStartupLogo::hideIfStillThere() -{ - if (m_instance) - m_instance->hide(); - // don't close, main() sets up a TQTimer for that -} - - -KStartupLogo* KStartupLogo::m_instance = 0; -bool KStartupLogo::m_wasClosed = false; - -#include "KStartupLogo.moc" diff --git a/src/gui/kdeext/KStartupLogo.h b/src/gui/kdeext/KStartupLogo.h deleted file mode 100644 index c8bd627..0000000 --- a/src/gui/kdeext/KStartupLogo.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- c-basic-offset: 4 -*- - -/* - Rosegarden - A sequencer and musical notation editor. - - This program is Copyright 2000-2008 - Guillaume Laurent , - Chris Cannam , - Richard Bown - - This file contains code borrowed from KDevelop 2.0 - Copyright (c) The KDevelop Development Team. - - The moral right of the authors to claim authorship of this work - has been asserted. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. See the file - COPYING included with this distribution for more information. -*/ - -#ifndef KSTARTUPLOGO_H -#define KSTARTUPLOGO_H - -#include -#include - -class KStartupLogo : public TQWidget -{ - Q_OBJECT - - -public: - static KStartupLogo* getInstance(); - - static void hideIfStillThere(); - - void setHideEnabled(bool enabled) { m_readyToHide = enabled; }; - void setShowTip(bool showTip) { m_showTip = showTip; }; - -public slots: - void slotShowStatusMessage(TQString); - virtual void close(); - -protected: - - KStartupLogo(TQWidget *parent=0, const char *name=0); - ~KStartupLogo(); - - virtual void paintEvent(TQPaintEvent*); - virtual void mousePressEvent( TQMouseEvent*); - - bool m_readyToHide; - bool m_showTip; - - TQPixmap m_pixmap; - - static KStartupLogo* m_instance; - static bool m_wasClosed; - TQString m_statusMessage; -}; - -#endif - - - - - diff --git a/src/gui/kdeext/TDEStartupLogo.cpp b/src/gui/kdeext/TDEStartupLogo.cpp new file mode 100644 index 0000000..6e57e2f --- /dev/null +++ b/src/gui/kdeext/TDEStartupLogo.cpp @@ -0,0 +1,155 @@ +// -*- c-basic-offset: 4 -*- + +/* + Rosegarden + A sequencer and musical notation editor. + + This program is Copyright 2000-2008 + Guillaume Laurent , + Chris Cannam , + Richard Bown + + This file contains code borrowed from KDevelop 2.0 + Copyright (c) The KDevelop Development Team. + + The moral right of the authors to claim authorship of this work + has been asserted. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "TDEStartupLogo.h" +#include "misc/Debug.h" + +TDEStartupLogo::TDEStartupLogo(TQWidget * parent, const char *name) + : TQWidget(parent, name, + WStyle_Customize | + WStyle_Splash + ), + m_readyToHide(false), + m_showTip(true) +{ + TQString pixmapFile = locate("appdata", "pixmaps/splash.png"); + if (!pixmapFile) + return ; + m_pixmap.load(pixmapFile); + setBackgroundPixmap(m_pixmap); + setGeometry(TQApplication::desktop()->width() / 2 - m_pixmap.width() / 2, + TQApplication::desktop()->height() / 2 - m_pixmap.height() / 2, + m_pixmap.width(), m_pixmap.height()); +} + +TDEStartupLogo::~TDEStartupLogo() +{ + m_wasClosed = true; + m_instance = 0; +} + +void TDEStartupLogo::paintEvent(TQPaintEvent*) +{ + // Print version number + TQPainter paint(this); + + TQFont defaultFont; + defaultFont.setPixelSize(12); + paint.setFont(defaultFont); + + TQFontMetrics metrics(defaultFont); + int width = metrics.width(m_statusMessage) + 6; + if (width > 200) + width = 200; + + int y = m_pixmap.height() - 12; + + // grep me: splash color + // TQColor bg(49, 94, 19); // color for 2006 splash + TQColor bg(19, 19, 19); // color for the 2008 splash + paint.setPen(bg); + paint.setBrush(bg); + paint.drawRect(TQRect(m_pixmap.width() - 220, m_pixmap.height() - 43, + 220, (y + 8) - (m_pixmap.height() - 43))); + + // paint.setPen(TQt::black); + // paint.setBrush(TQt::black); + paint.setPen(TQt::white); + paint.setBrush(TQt::white); + + //TQString version(VERSION); + //int sepIdx = version.find("-"); + TQString versionLabel(VERSION); + //TQString("R%1 v%2").arg(version.left(sepIdx)).arg(version.mid(sepIdx + 1)); + int versionWidth = metrics.width(versionLabel); + + paint.drawText(m_pixmap.width() - versionWidth - 18, + m_pixmap.height() - 28, + versionLabel); + + paint.drawText(m_pixmap.width() - (width + 10), y, m_statusMessage); +} + +void TDEStartupLogo::slotShowStatusMessage(TQString message) +{ + m_statusMessage = message; + paintEvent(0); + TQApplication::flushX(); +} + +void TDEStartupLogo::close() +{ + if (!m_wasClosed && isVisible()) { + + if (m_showTip) { + RG_DEBUG << "TDEStartupLogo::close: Showing Tips\n"; + KTipDialog::showTip(locate("data", "rosegarden/tips")); + } + } + + TQWidget::close(); +} + + +void TDEStartupLogo::mousePressEvent(TQMouseEvent*) +{ + // for the haters of raising startlogos + if (m_readyToHide) + hide(); // don't close, main() sets up a TQTimer for that +} + +TDEStartupLogo* TDEStartupLogo::getInstance() +{ + if (m_wasClosed) + return 0; + + if (!m_instance) + m_instance = new TDEStartupLogo; + + return m_instance; +} + +void TDEStartupLogo::hideIfStillThere() +{ + if (m_instance) + m_instance->hide(); + // don't close, main() sets up a TQTimer for that +} + + +TDEStartupLogo* TDEStartupLogo::m_instance = 0; +bool TDEStartupLogo::m_wasClosed = false; + +#include "TDEStartupLogo.moc" diff --git a/src/gui/kdeext/TDEStartupLogo.h b/src/gui/kdeext/TDEStartupLogo.h new file mode 100644 index 0000000..7e6e586 --- /dev/null +++ b/src/gui/kdeext/TDEStartupLogo.h @@ -0,0 +1,71 @@ +// -*- c-basic-offset: 4 -*- + +/* + Rosegarden + A sequencer and musical notation editor. + + This program is Copyright 2000-2008 + Guillaume Laurent , + Chris Cannam , + Richard Bown + + This file contains code borrowed from KDevelop 2.0 + Copyright (c) The KDevelop Development Team. + + The moral right of the authors to claim authorship of this work + has been asserted. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef KSTARTUPLOGO_H +#define KSTARTUPLOGO_H + +#include +#include + +class TDEStartupLogo : public TQWidget +{ + Q_OBJECT + + +public: + static TDEStartupLogo* getInstance(); + + static void hideIfStillThere(); + + void setHideEnabled(bool enabled) { m_readyToHide = enabled; }; + void setShowTip(bool showTip) { m_showTip = showTip; }; + +public slots: + void slotShowStatusMessage(TQString); + virtual void close(); + +protected: + + TDEStartupLogo(TQWidget *parent=0, const char *name=0); + ~TDEStartupLogo(); + + virtual void paintEvent(TQPaintEvent*); + virtual void mousePressEvent( TQMouseEvent*); + + bool m_readyToHide; + bool m_showTip; + + TQPixmap m_pixmap; + + static TDEStartupLogo* m_instance; + static bool m_wasClosed; + TQString m_statusMessage; +}; + +#endif + + + + + diff --git a/src/gui/seqmanager/SequenceManager.cpp b/src/gui/seqmanager/SequenceManager.cpp index a8d6e30..e0b0b2d 100644 --- a/src/gui/seqmanager/SequenceManager.cpp +++ b/src/gui/seqmanager/SequenceManager.cpp @@ -47,7 +47,7 @@ #include "gui/dialogs/AudioManagerDialog.h" #include "gui/dialogs/CountdownDialog.h" #include "gui/dialogs/TransportDialog.h" -#include "gui/kdeext/KStartupLogo.h" +#include "gui/kdeext/TDEStartupLogo.h" #include "gui/studio/StudioControl.h" #include "gui/widgets/CurrentProgressDialog.h" #include "MetronomeMmapper.h" @@ -1139,7 +1139,7 @@ SequenceManager::processAsynchronousMidi(const MappedComposition &mC, } } } else { - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); if ((*i)->getType() == MappedEvent::SystemFailure) { @@ -1160,7 +1160,7 @@ SequenceManager::processAsynchronousMidi(const MappedComposition &mC, std::cerr << "Rosegarden: WARNING: No accurate sequencer timer available" << std::endl; - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); RosegardenGUIApp::self()->awaitDialogClearance(); @@ -1178,7 +1178,7 @@ SequenceManager::processAsynchronousMidi(const MappedComposition &mC, std::cerr << "Rosegarden: WARNING: No accurate sequencer timer available" << std::endl; - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); RosegardenGUIApp::self()->awaitDialogClearance(); @@ -1303,7 +1303,7 @@ SequenceManager::checkSoundDriverStatus(bool warnUser) (MIDI_OK | VERSION_OK)) return; #endif - KStartupLogo::hideIfStillThere(); + TDEStartupLogo::hideIfStillThere(); CurrentProgressDialog::freeze(); TQString text = ""; -- cgit v1.2.3