add default session path
This commit is contained in:
@@ -7,6 +7,15 @@
|
|||||||
# include <QScreen>
|
# include <QScreen>
|
||||||
#endif
|
#endif
|
||||||
#include "session_manager.h"
|
#include "session_manager.h"
|
||||||
|
#include "qad_locations.h"
|
||||||
|
|
||||||
|
|
||||||
|
SessionManager::SessionManager(QString file) {
|
||||||
|
if (file.isEmpty() && !QCoreApplication::applicationName().isEmpty()) {
|
||||||
|
file = QAD::userPath(QAD::ltConfig, "session");
|
||||||
|
}
|
||||||
|
setFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::setFile(const QString & file) {
|
void SessionManager::setFile(const QString & file) {
|
||||||
@@ -34,7 +43,10 @@ void SessionManager::removeMainWidget(QWidget * e) {
|
|||||||
|
|
||||||
|
|
||||||
void SessionManager::save() {
|
void SessionManager::save() {
|
||||||
if (file_.isEmpty()) return;
|
if (file_.isEmpty()) {
|
||||||
|
qDebug() << "[SessionManager] filename is empty";
|
||||||
|
return;
|
||||||
|
}
|
||||||
QPIConfig sr(file_);
|
QPIConfig sr(file_);
|
||||||
QObjectList tsc;
|
QObjectList tsc;
|
||||||
for (int i = 0; i < mwindows.size(); ++i) {
|
for (int i = 0; i < mwindows.size(); ++i) {
|
||||||
@@ -137,19 +149,14 @@ void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) {
|
|||||||
srect.y() + (srect.height() - w->height()) / 2,
|
srect.y() + (srect.height() - w->height()) / 2,
|
||||||
w->width(), w->height());
|
w->width(), w->height());
|
||||||
}
|
}
|
||||||
/*if (w->windowState().testFlag(Qt::WindowMaximized)) {
|
|
||||||
foreach (QScreen * s, sl) {
|
|
||||||
if (s->geometry().contains(w->geometry())) {
|
|
||||||
//w->setGeometry(s->availableGeometry());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::load(bool onlyMainwindow) {
|
void SessionManager::load(bool onlyMainwindow) {
|
||||||
if (file_.isEmpty()) return;
|
if (file_.isEmpty()) {
|
||||||
|
qDebug() << "[SessionManager] filename is empty";
|
||||||
|
return;
|
||||||
|
}
|
||||||
QPIConfig sr(file_);
|
QPIConfig sr(file_);
|
||||||
QObjectList tsc;
|
QObjectList tsc;
|
||||||
for (int i = 0; i < mwindows.size(); ++i) {
|
for (int i = 0; i < mwindows.size(); ++i) {
|
||||||
|
|||||||
@@ -47,8 +47,7 @@ class QAD_EXPORT SessionManager: public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SessionManager(const QString & file = QString()) {setFile(file);}
|
SessionManager(QString file = QString());
|
||||||
~SessionManager() {;}
|
|
||||||
|
|
||||||
void setFile(const QString & file);
|
void setFile(const QString & file);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user