Refactoring. StrippedName() doesn't belong to MainWindows.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-31 10:46:45 +02:00
parent 80ff422a39
commit 82190e2917
4 changed files with 16 additions and 14 deletions

View file

@ -38,6 +38,7 @@
#include "core/vapplication.h"
#include "../vmisc/undoevent.h"
#include "../vmisc/vsettings.h"
#include "../vmisc/def.h"
#include "undocommands/renamepp.h"
#include "core/vtooloptionspropertybrowser.h"
#include "options.h"
@ -2828,7 +2829,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
curFile = fileName;
qApp->getUndoStack()->setClean();
QString shownName = strippedName(curFile);
QString shownName = StrippedName(curFile);
if (curFile.isEmpty())
{
shownName = tr("untitled.val");
@ -2858,17 +2859,6 @@ void MainWindow::setCurrentFile(const QString &fileName)
setWindowTitle(shownName);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief strippedName the function call around curFile to exclude the path to the file.
* @param fullFileName full path to the file.
* @return file name.
*/
QString MainWindow::strippedName(const QString &fullFileName)
{
return QFileInfo(fullFileName).fileName();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ReadSettings read setting for app.
@ -2941,7 +2931,7 @@ void MainWindow::UpdateRecentFileActions()
for (int i = 0; i < numRecentFiles; ++i)
{
QString text = QString("&%1. %2").arg(i + 1).arg(strippedName(files.at(i)));
QString text = QString("&%1. %2").arg(i + 1).arg(StrippedName(files.at(i)));
recentFileActs[i]->setText(text);
recentFileActs[i]->setData(files.at(i));
recentFileActs[i]->setVisible(true);

View file

@ -266,7 +266,6 @@ private:
bool SavePattern(const QString &curFile, QString &error);
void AutoSavePattern();
void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName);
void ReadSettings();
void WriteSettings();

View file

@ -1670,3 +1670,14 @@ QString MapDiagrams(const QString &number)
return QString();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief strippedName the function call around curFile to exclude the path to the file.
* @param fullFileName full path to the file.
* @return file name.
*/
QString StrippedName(const QString &fullFileName)
{
return QFileInfo(fullFileName).fileName();
}

View file

@ -587,4 +587,6 @@ void CheckFactor(qreal &oldFactor, const qreal &Newfactor);
QStringList SupportedLocales();
QStringList AllGroupNames();
QString StrippedName(const QString &fullFileName);
#endif // DEF_H