diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 5ceb060bd..1da1d13ca 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -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); diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 0e7d1d790..07bb83c89 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -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(); diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index 4a98338d2..29afeb98f 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -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(); +} diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 5dac1081a..0f5b95245 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -587,4 +587,6 @@ void CheckFactor(qreal &oldFactor, const qreal &Newfactor); QStringList SupportedLocales(); QStringList AllGroupNames(); +QString StrippedName(const QString &fullFileName); + #endif // DEF_H