mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
small simplification
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21719 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
573722b8de
commit
dcac6d3375
@ -108,20 +108,13 @@ using support::trim;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
int const statusbar_timer_value = 3000;
|
|
||||||
|
|
||||||
class BackgroundWidget : public QWidget
|
class BackgroundWidget : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BackgroundWidget(QString const & file, QString const & text)
|
BackgroundWidget(QString const & file, QString const & text)
|
||||||
|
: splash_(file)
|
||||||
{
|
{
|
||||||
splash_ = new QPixmap(file);
|
QPainter pain(&splash_);
|
||||||
if (!splash_) {
|
|
||||||
lyxerr << "could not load splash screen: '" << fromqstr(file) << "'" << endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPainter pain(splash_);
|
|
||||||
pain.setPen(QColor(255, 255, 0));
|
pain.setPen(QColor(255, 255, 0));
|
||||||
QFont font;
|
QFont font;
|
||||||
// The font used to display the version info
|
// The font used to display the version info
|
||||||
@ -134,17 +127,14 @@ public:
|
|||||||
|
|
||||||
void paintEvent(QPaintEvent *)
|
void paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
if (!splash_)
|
int x = (width() - splash_.width()) / 2;
|
||||||
return;
|
int y = (height() - splash_.height()) / 2;
|
||||||
|
|
||||||
int x = (width() - splash_->width()) / 2;
|
|
||||||
int y = (height() - splash_->height()) / 2;
|
|
||||||
QPainter pain(this);
|
QPainter pain(this);
|
||||||
pain.drawPixmap(x, y, *splash_);
|
pain.drawPixmap(x, y, splash_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPixmap * splash_;
|
QPixmap splash_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
@ -156,8 +146,7 @@ struct GuiView::GuiViewPrivate
|
|||||||
{
|
{
|
||||||
GuiViewPrivate()
|
GuiViewPrivate()
|
||||||
: current_work_area_(0), layout_(0),
|
: current_work_area_(0), layout_(0),
|
||||||
autosave_timeout_(new Timeout(5000)), quitting_by_menu_(false),
|
quitting_by_menu_(false), autosave_timeout_(5000), in_show_(false)
|
||||||
in_show_(false)
|
|
||||||
{
|
{
|
||||||
// hardcode here the platform specific icon size
|
// hardcode here the platform specific icon size
|
||||||
smallIconSize = 14; // scaling problems
|
smallIconSize = 14; // scaling problems
|
||||||
@ -179,7 +168,6 @@ struct GuiView::GuiViewPrivate
|
|||||||
delete stack_widget_;
|
delete stack_widget_;
|
||||||
delete menubar_;
|
delete menubar_;
|
||||||
delete toolbars_;
|
delete toolbars_;
|
||||||
delete autosave_timeout_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu * toolBarPopup(GuiView * parent)
|
QMenu * toolBarPopup(GuiView * parent)
|
||||||
@ -295,7 +283,7 @@ public:
|
|||||||
/// are we quitting by the menu?
|
/// are we quitting by the menu?
|
||||||
bool quitting_by_menu_;
|
bool quitting_by_menu_;
|
||||||
/// auto-saving of buffers
|
/// auto-saving of buffers
|
||||||
Timeout * const autosave_timeout_;
|
Timeout autosave_timeout_;
|
||||||
///
|
///
|
||||||
/// flag against a race condition due to multiclicks in Qt frontend,
|
/// flag against a race condition due to multiclicks in Qt frontend,
|
||||||
/// see bug #1119
|
/// see bug #1119
|
||||||
@ -314,11 +302,11 @@ GuiView::GuiView(int id)
|
|||||||
|
|
||||||
// Start autosave timer
|
// Start autosave timer
|
||||||
if (lyxrc.autosave) {
|
if (lyxrc.autosave) {
|
||||||
d.autosave_timeout_->timeout.connect(boost::bind(&GuiView::autoSave, this));
|
d.autosave_timeout_.timeout.connect(boost::bind(&GuiView::autoSave, this));
|
||||||
d.autosave_timeout_->setTimeout(lyxrc.autosave * 1000);
|
d.autosave_timeout_.setTimeout(lyxrc.autosave * 1000);
|
||||||
d.autosave_timeout_->start();
|
d.autosave_timeout_.start();
|
||||||
}
|
}
|
||||||
QObject::connect(&d.statusbar_timer_, SIGNAL(timeout()),
|
connect(&d.statusbar_timer_, SIGNAL(timeout()),
|
||||||
this, SLOT(clearMessage()));
|
this, SLOT(clearMessage()));
|
||||||
|
|
||||||
// Qt bug? signal lastWindowClosed does not work
|
// Qt bug? signal lastWindowClosed does not work
|
||||||
@ -485,7 +473,7 @@ void GuiView::message(docstring const & str)
|
|||||||
{
|
{
|
||||||
statusBar()->showMessage(toqstr(str));
|
statusBar()->showMessage(toqstr(str));
|
||||||
d.statusbar_timer_.stop();
|
d.statusbar_timer_.stop();
|
||||||
d.statusbar_timer_.start(statusbar_timer_value);
|
d.statusbar_timer_.start(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -941,7 +929,7 @@ void GuiView::autoSave()
|
|||||||
void GuiView::resetAutosaveTimers()
|
void GuiView::resetAutosaveTimers()
|
||||||
{
|
{
|
||||||
if (lyxrc.autosave)
|
if (lyxrc.autosave)
|
||||||
d.autosave_timeout_->restart();
|
d.autosave_timeout_.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,8 +17,7 @@
|
|||||||
|
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
|
|
||||||
#include <string>
|
#include "support/strfwd.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user