diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index a2cb6718d7..ae3dc10eec 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,10 @@ +2001-03-15 Edwin Leuven + + * Added splash screen + * Makefile.am: updated + * FormSplash.[Ch]: added + * FormSplashImpl.[Ch]: added + 2001-03-09 Edwin Leuven * Makefile.am: updated diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 562bb2f3d4..72d326a3ef 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -25,6 +25,7 @@ #include "FormPrint.h" #include "FormRef.h" #include "FormSearch.h" +#include "FormSplash.h" #include "FormTabular.h" #include "FormTabularCreate.h" #include "FormToc.h" @@ -43,6 +44,8 @@ Signal0 Dialogs::redrawGUI; Dialogs::Dialogs(LyXView * lv) { + splash_ = new FormSplash(lv, this); + dialogs_.push_back(new FormCharacter(lv, this)); dialogs_.push_back(new FormCitation(lv, this)); dialogs_.push_back(new FormCopyright(lv, this)); @@ -69,9 +72,17 @@ Dialogs::Dialogs(LyXView * lv) Dialogs::~Dialogs() { - for (vector::iterator iter = dialogs_.begin(); - iter != dialogs_.end(); - ++iter) { - delete *iter; - } + for (vector::iterator iter = dialogs_.begin(); + iter != dialogs_.end(); + ++iter) { + delete *iter; + } + delete splash_; +} + + +void Dialogs::destroySplash() +{ + delete splash_; + splash_ = 0; } diff --git a/src/frontends/qt2/FormSplash.C b/src/frontends/qt2/FormSplash.C new file mode 100644 index 0000000000..cba4f39f9b --- /dev/null +++ b/src/frontends/qt2/FormSplash.C @@ -0,0 +1,48 @@ +/** + * \file FormSplash.C + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author Edwin Leuven + */ + +#include + +#include + +#include "FormSplashImpl.h" +#include "FormSplash.h" +#include "Dialogs.h" +#include "version.h" +#include "support/filetools.h" +#include "lyxrc.h" + +FormSplash::FormSplash(LyXView *, Dialogs * d) + : dialog_(0), d_(d) +{ + c_ = d->showSplash.connect(slot(this, &FormSplash::show)); +} + + +FormSplash::~FormSplash() +{ + c_.disconnect(); + delete dialog_; +} + +void FormSplash::hide() +{ + dialog_->hide(); +} + +void FormSplash::show() +{ + if (!lyxrc.show_banner) + return; + + if (!dialog_) + dialog_ = new FormSplashBase( 0, "LyX"); + + // show banner + dialog_->show(); +} diff --git a/src/frontends/qt2/FormSplash.h b/src/frontends/qt2/FormSplash.h new file mode 100644 index 0000000000..5d9c87f7f2 --- /dev/null +++ b/src/frontends/qt2/FormSplash.h @@ -0,0 +1,42 @@ +/** + * \file FormSplash.h + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author Edwin Leuven + */ + +#ifndef FORMSPLASH_H +#define FORMSPLASH_H + +#include "DialogBase.h" + +class Dialogs; +class LyXView; +class FormSplashBase; + +/** The startup splash screen + */ +class FormSplash : public DialogBase { + + public: + FormSplash(LyXView *, Dialogs *); + + ~FormSplash(); + + /// hide the dialog + void hide(); + + private: + /// show the dialog + void show(); + + /// Real GUI implementation. + FormSplashBase * dialog_; + /// our container + Dialogs * d_; + /// the show connection + Connection c_; +}; + +#endif // FORMSPLASH_H diff --git a/src/frontends/qt2/FormSplashImpl.C b/src/frontends/qt2/FormSplashImpl.C new file mode 100644 index 0000000000..2380b4fa6f --- /dev/null +++ b/src/frontends/qt2/FormSplashImpl.C @@ -0,0 +1,52 @@ +/** + * \file FormSplashBase.C + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author Edwin Leuven + */ + +#include + +#include +#include +#include +#include + +#include "FormSplashImpl.h" +#include "version.h" +#include "support/filetools.h" +#include "lyxrc.h" + +FormSplashBase::FormSplashBase( QWidget* parent, const char* name, WFlags fl, bool modal ) + : QFrame( parent, name, fl, modal) +{ + string banner_file = LibFileSearch("images", "banner", "xpm"); + if (banner_file.empty()) + return; + + QPixmap pm(tostr(banner_file).c_str()); + int w = pm.width(); + int h = pm.height(); + + setBackgroundPixmap(pm); + setLineWidth(0); + setGeometry(QApplication::desktop()->width ()/2-w/2, + QApplication::desktop()->height()/2-h/2, + w, h ); + + QTimer::singleShot( 5*1000, this, SLOT(hide()) ); +} + +FormSplashBase::~FormSplashBase() +{ +} + + +void FormSplashBase::mousePressEvent( QMouseEvent * e) +{ + hide(); +} + + + diff --git a/src/frontends/qt2/FormSplashImpl.h b/src/frontends/qt2/FormSplashImpl.h new file mode 100644 index 0000000000..fb8e4a6e03 --- /dev/null +++ b/src/frontends/qt2/FormSplashImpl.h @@ -0,0 +1,27 @@ +/** + * \file FormSplashBase.C + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author Edwin Leuven + */ + +#ifndef FORMSPLASHBASE_H +#define FORMSPLASHBASE_H + +class FormSplashBase : public QFrame +{ + public: + + FormSplashBase(QWidget* parent, const char* name, + WFlags fl = QWidget::WStyle_NoBorder | QWidget::WStyle_Customize, + bool modal = false ); + + ~FormSplashBase(); + + protected: + + virtual void mousePressEvent( QMouseEvent * ); +}; + +#endif // FORMSPLASHBASE_H diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index 111510068b..d0c6057263 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -25,6 +25,7 @@ BUILTSOURCES = \ moc_tabularcreatedlgimpl.C \ moc_emptytable.C + LYXDATADIRS = dlg DISTCLEANFILES = $(BUILTSOURCES) *.orig *.rej *~ *.bak core @@ -108,6 +109,10 @@ libqt2_la_SOURCES = \ searchdlg.h \ searchdlgimpl.C \ searchdlgimpl.h \ + FormSplash.C \ + FormSplash.h \ + FormSplashImpl.C \ + FormSplashImpl.h \ FormTabularCreate.C \ FormTabularCreate.h \ tabularcreatedlg.C \