Change autosave notification to message by rooms. (#22)
This commit is contained in:
parent
97dbaef5c6
commit
f7350c4601
6 changed files with 42 additions and 4 deletions
|
@ -1672,6 +1672,7 @@ bool IoCmd::saveAll() {
|
|||
QObject::tr("An error occured while saving. \n"
|
||||
"Please check your work and try again."));
|
||||
}
|
||||
if (result) TApp::instance()->showMessage("Saved");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -415,6 +415,9 @@ centralWidget->setLayout(centralWidgetLayout);*/
|
|||
/*-- タイトルバーにScene名を表示する --*/
|
||||
connect(TApp::instance()->getCurrentScene(), SIGNAL(nameSceneChanged()), this,
|
||||
SLOT(changeWindowTitle()));
|
||||
connect(TApp::instance(), SIGNAL(sendMessage(QString)), m_topBar,
|
||||
SLOT(setMessage(QString)));
|
||||
|
||||
changeWindowTitle();
|
||||
|
||||
// Connetto i comandi che sono in RoomTabWidget
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
#include <QCheckBox>
|
||||
#include <QtDebug>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <QGraphicsOpacityEffect>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
void UrlOpener::open() { QDesktopServices::openUrl(m_url); }
|
||||
|
||||
|
@ -802,6 +806,8 @@ TopBar::TopBar(QWidget *parent) : QToolBar(parent) {
|
|||
m_roomTabBar = new RoomTabWidget(this);
|
||||
m_stackedMenuBar = new StackedMenuBar(this);
|
||||
m_lockRoomCB = new QCheckBox(this);
|
||||
m_messageLabel = new QLabel(this);
|
||||
m_messageLabel->setStyleSheet("color: lightgreen;");
|
||||
|
||||
m_containerFrame->setObjectName("TopBarTabContainer");
|
||||
m_roomTabBar->setObjectName("TopBarTab");
|
||||
|
@ -824,6 +830,8 @@ TopBar::TopBar(QWidget *parent) : QToolBar(parent) {
|
|||
}
|
||||
mainLayout->addLayout(menuLayout);
|
||||
mainLayout->addStretch(1);
|
||||
mainLayout->addWidget(m_messageLabel, 0);
|
||||
mainLayout->addSpacing(2);
|
||||
mainLayout->addWidget(m_roomTabBar, 0);
|
||||
mainLayout->addSpacing(2);
|
||||
mainLayout->addWidget(m_lockRoomCB, 0);
|
||||
|
@ -847,3 +855,18 @@ TopBar::TopBar(QWidget *parent) : QToolBar(parent) {
|
|||
SLOT(setIsLocked(bool)));
|
||||
assert(ret);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TopBar::setMessage(QString message) {
|
||||
m_messageLabel->setText(message);
|
||||
QGraphicsOpacityEffect *eff = new QGraphicsOpacityEffect(this);
|
||||
m_messageLabel->setGraphicsEffect(eff);
|
||||
QPropertyAnimation *a = new QPropertyAnimation(eff, "opacity");
|
||||
a->setDuration(4000);
|
||||
a->setStartValue(1);
|
||||
a->setEndValue(0);
|
||||
a->setEasingCurve(QEasingCurve::OutBack);
|
||||
a->start(QPropertyAnimation::DeleteWhenStopped);
|
||||
connect(a, SIGNAL(finished()), m_messageLabel, SLOT(clear()));
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ class QHBoxLayout;
|
|||
class SubXsheetRoomTabContainer;
|
||||
class QCheckBox;
|
||||
class QXmlStreamReader;
|
||||
class QLabel;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -171,6 +172,7 @@ class TopBar final : public QToolBar {
|
|||
RoomTabWidget *m_roomTabBar;
|
||||
StackedMenuBar *m_stackedMenuBar;
|
||||
QCheckBox *m_lockRoomCB;
|
||||
QLabel *m_messageLabel;
|
||||
|
||||
public:
|
||||
TopBar(QWidget *parent);
|
||||
|
@ -180,6 +182,9 @@ public:
|
|||
|
||||
StackedMenuBar *getStackedMenuBar() const { return m_stackedMenuBar; }
|
||||
|
||||
public slots:
|
||||
void setMessage(QString message);
|
||||
|
||||
protected:
|
||||
/*-- 右クリックで消えないようにする--*/
|
||||
void contextMenuEvent(QContextMenuEvent *event) override { event->accept(); }
|
||||
|
|
|
@ -666,9 +666,9 @@ void TApp::autosave() {
|
|||
} else
|
||||
m_autosaveSuspended = false;
|
||||
|
||||
DVGui::ProgressDialog pb(
|
||||
"Autosaving scene..." + toQString(scene->getScenePath()), 0, 0, 1);
|
||||
pb.show();
|
||||
// DVGui::ProgressDialog pb(
|
||||
// "Autosaving scene..." + toQString(scene->getScenePath()), 0, 0, 1);
|
||||
// pb.show();
|
||||
Preferences *pref = Preferences::instance();
|
||||
if (pref->isAutosaveSceneEnabled() && pref->isAutosaveOtherFilesEnabled()) {
|
||||
IoCmd::saveAll();
|
||||
|
@ -678,7 +678,7 @@ void TApp::autosave() {
|
|||
IoCmd::saveNonSceneFiles();
|
||||
}
|
||||
|
||||
pb.setValue(1);
|
||||
// pb.setValue(1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -730,3 +730,6 @@ QString TApp::getCurrentRoomName() const {
|
|||
|
||||
return currentRoom->getName();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void TApp::showMessage(QString message) { emit(sendMessage(message)); }
|
||||
|
|
|
@ -205,6 +205,8 @@ public:
|
|||
|
||||
XsheetViewer *getCurrentXsheetViewer() const { return m_xsheetViewer; }
|
||||
|
||||
void showMessage(QString message);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
|
@ -246,6 +248,7 @@ signals:
|
|||
// NOTE: For now QEvent::TabletLeaveProximity is NOT detected on Windows. See
|
||||
// QTBUG-53628.
|
||||
void tabletLeft();
|
||||
void sendMessage(QString);
|
||||
|
||||
void
|
||||
activeViewerChanged(); // TODO: put widgets-related stuffs in some new handle
|
||||
|
|
Loading…
Reference in a new issue