forked from qt-creator/qt-creator
SessionFile: Remove m_fileName
It's easily constructed from sessionName, thus removing one member Change-Id: I8ae92db0732dada6baa7b50ec84d7b95a16efed6 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -87,9 +87,7 @@ public:
|
|||||||
SessionFile();
|
SessionFile();
|
||||||
|
|
||||||
bool load(const QString &fileName);
|
bool load(const QString &fileName);
|
||||||
bool save();
|
bool save(const QString &fileName);
|
||||||
|
|
||||||
void setFileName(const QString &fileName);
|
|
||||||
|
|
||||||
QStringList failedProjectFileNames() const;
|
QStringList failedProjectFileNames() const;
|
||||||
void clearFailedProjectFileNames();
|
void clearFailedProjectFileNames();
|
||||||
@@ -98,7 +96,6 @@ public slots:
|
|||||||
void sessionLoadingProgress();
|
void sessionLoadingProgress();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_fileName;
|
|
||||||
QList<Project *> m_projects;
|
QList<Project *> m_projects;
|
||||||
Project *m_startupProject;
|
Project *m_startupProject;
|
||||||
QStringList m_failedProjects;
|
QStringList m_failedProjects;
|
||||||
@@ -134,13 +131,11 @@ bool SessionFile::load(const QString &fileName)
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "SessionFile::load " << fileName;
|
qDebug() << "SessionFile::load " << fileName;
|
||||||
|
|
||||||
m_fileName = fileName;
|
|
||||||
|
|
||||||
// NPE: Load the session in the background?
|
// NPE: Load the session in the background?
|
||||||
// NPE: Let FileManager monitor filename
|
// NPE: Let FileManager monitor filename
|
||||||
|
|
||||||
PersistentSettingsReader reader;
|
PersistentSettingsReader reader;
|
||||||
if (!reader.load(m_fileName)) {
|
if (!reader.load(fileName)) {
|
||||||
qWarning() << "SessionManager::load failed!" << fileName;
|
qWarning() << "SessionManager::load failed!" << fileName;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -223,10 +218,10 @@ bool SessionFile::load(const QString &fileName)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionFile::save()
|
bool SessionFile::save(const QString &fileName)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "SessionFile - saving " << m_fileName;
|
qDebug() << "SessionFile - saving " << fileName;
|
||||||
|
|
||||||
PersistentSettingsWriter writer;
|
PersistentSettingsWriter writer;
|
||||||
|
|
||||||
@@ -280,17 +275,12 @@ bool SessionFile::save()
|
|||||||
writer.saveValue(QLatin1String("valueKeys"), keys);
|
writer.saveValue(QLatin1String("valueKeys"), keys);
|
||||||
|
|
||||||
|
|
||||||
if (writer.save(m_fileName, QLatin1String("QtCreatorSession"), Core::ICore::mainWindow()))
|
if (writer.save(fileName, QLatin1String("QtCreatorSession"), Core::ICore::mainWindow()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionFile::setFileName(const QString &fileName)
|
|
||||||
{
|
|
||||||
m_fileName = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList SessionFile::failedProjectFileNames() const
|
QStringList SessionFile::failedProjectFileNames() const
|
||||||
{
|
{
|
||||||
return m_failedProjects;
|
return m_failedProjects;
|
||||||
@@ -333,8 +323,6 @@ SessionManager::SessionManager(QObject *parent)
|
|||||||
connect(em, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
connect(em, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||||
this, SLOT(markSessionFileDirty()));
|
this, SLOT(markSessionFileDirty()));
|
||||||
|
|
||||||
m_file->setFileName(sessionNameToFileName(m_sessionName));
|
|
||||||
|
|
||||||
m_autoSaveSessionTimer = new QTimer(this);
|
m_autoSaveSessionTimer = new QTimer(this);
|
||||||
m_autoSaveSessionTimer->setSingleShot(true);
|
m_autoSaveSessionTimer->setSingleShot(true);
|
||||||
m_autoSaveSessionTimer->setInterval(10000);
|
m_autoSaveSessionTimer->setInterval(10000);
|
||||||
@@ -551,7 +539,6 @@ bool SessionManager::createImpl(const QString &fileName)
|
|||||||
emit aboutToLoadSession(sessionName);
|
emit aboutToLoadSession(sessionName);
|
||||||
m_sessionName = sessionName;
|
m_sessionName = sessionName;
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
m_file->setFileName(fileName);
|
|
||||||
setStartupProject(0);
|
setStartupProject(0);
|
||||||
|
|
||||||
if (!isDefaultVirgin()) {
|
if (!isDefaultVirgin()) {
|
||||||
@@ -648,11 +635,12 @@ bool SessionManager::save()
|
|||||||
|
|
||||||
emit aboutToSaveSession();
|
emit aboutToSaveSession();
|
||||||
|
|
||||||
bool result = m_file->save();
|
QString fileName = sessionNameToFileName(m_sessionName);
|
||||||
|
bool result = m_file->save(fileName);
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
QMessageBox::warning(0, tr("Error while saving session"),
|
QMessageBox::warning(0, tr("Error while saving session"),
|
||||||
tr("Could not save session to file %1").arg(sessionNameToFileName(m_sessionName)));
|
tr("Could not save session to file %1").arg(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
Reference in New Issue
Block a user