add default session path
This commit is contained in:
@@ -7,6 +7,15 @@
|
||||
# include <QScreen>
|
||||
#endif
|
||||
#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) {
|
||||
@@ -34,7 +43,10 @@ void SessionManager::removeMainWidget(QWidget * e) {
|
||||
|
||||
|
||||
void SessionManager::save() {
|
||||
if (file_.isEmpty()) return;
|
||||
if (file_.isEmpty()) {
|
||||
qDebug() << "[SessionManager] filename is empty";
|
||||
return;
|
||||
}
|
||||
QPIConfig sr(file_);
|
||||
QObjectList tsc;
|
||||
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,
|
||||
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) {
|
||||
if (file_.isEmpty()) return;
|
||||
if (file_.isEmpty()) {
|
||||
qDebug() << "[SessionManager] filename is empty";
|
||||
return;
|
||||
}
|
||||
QPIConfig sr(file_);
|
||||
QObjectList tsc;
|
||||
for (int i = 0; i < mwindows.size(); ++i) {
|
||||
|
||||
@@ -47,8 +47,7 @@ class QAD_EXPORT SessionManager: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SessionManager(const QString & file = QString()) {setFile(file);}
|
||||
~SessionManager() {;}
|
||||
SessionManager(QString file = QString());
|
||||
|
||||
void setFile(const QString & file);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user