Added splash for qt2 frontend, Edwin

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1776 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Edwin Leuven 2001-03-15 16:34:44 +00:00
parent 017805b341
commit 50dd8f5894
7 changed files with 197 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2001-03-15 Edwin Leuven <leuven@fee.uva.nl>
* Added splash screen
* Makefile.am: updated
* FormSplash.[Ch]: added
* FormSplashImpl.[Ch]: added
2001-03-09 Edwin Leuven <leuven@fee.uva.nl> 2001-03-09 Edwin Leuven <leuven@fee.uva.nl>
* Makefile.am: updated * Makefile.am: updated

View File

@ -25,6 +25,7 @@
#include "FormPrint.h" #include "FormPrint.h"
#include "FormRef.h" #include "FormRef.h"
#include "FormSearch.h" #include "FormSearch.h"
#include "FormSplash.h"
#include "FormTabular.h" #include "FormTabular.h"
#include "FormTabularCreate.h" #include "FormTabularCreate.h"
#include "FormToc.h" #include "FormToc.h"
@ -43,6 +44,8 @@ Signal0<void> Dialogs::redrawGUI;
Dialogs::Dialogs(LyXView * lv) Dialogs::Dialogs(LyXView * lv)
{ {
splash_ = new FormSplash(lv, this);
dialogs_.push_back(new FormCharacter(lv, this)); dialogs_.push_back(new FormCharacter(lv, this));
dialogs_.push_back(new FormCitation(lv, this)); dialogs_.push_back(new FormCitation(lv, this));
dialogs_.push_back(new FormCopyright(lv, this)); dialogs_.push_back(new FormCopyright(lv, this));
@ -74,4 +77,12 @@ Dialogs::~Dialogs()
++iter) { ++iter) {
delete *iter; delete *iter;
} }
delete splash_;
}
void Dialogs::destroySplash()
{
delete splash_;
splash_ = 0;
} }

View File

@ -0,0 +1,48 @@
/**
* \file FormSplash.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven
*/
#include <config.h>
#include <qframe.h>
#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();
}

View File

@ -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

View File

@ -0,0 +1,52 @@
/**
* \file FormSplashBase.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven
*/
#include <config.h>
#include <qapplication.h>
#include <qtimer.h>
#include <qframe.h>
#include <qpixmap.h>
#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();
}

View File

@ -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

View File

@ -26,6 +26,7 @@ BUILTSOURCES = \
moc_emptytable.C moc_emptytable.C
LYXDATADIRS = dlg LYXDATADIRS = dlg
DISTCLEANFILES = $(BUILTSOURCES) *.orig *.rej *~ *.bak core DISTCLEANFILES = $(BUILTSOURCES) *.orig *.rej *~ *.bak core
@ -108,6 +109,10 @@ libqt2_la_SOURCES = \
searchdlg.h \ searchdlg.h \
searchdlgimpl.C \ searchdlgimpl.C \
searchdlgimpl.h \ searchdlgimpl.h \
FormSplash.C \
FormSplash.h \
FormSplashImpl.C \
FormSplashImpl.h \
FormTabularCreate.C \ FormTabularCreate.C \
FormTabularCreate.h \ FormTabularCreate.h \
tabularcreatedlg.C \ tabularcreatedlg.C \