Refactoring. StrippedName() doesn't belong to MainWindows.
--HG-- branch : develop
This commit is contained in:
parent
80ff422a39
commit
82190e2917
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -587,4 +587,6 @@ void CheckFactor(qreal &oldFactor, const qreal &Newfactor);
|
|||
QStringList SupportedLocales();
|
||||
QStringList AllGroupNames();
|
||||
|
||||
QString StrippedName(const QString &fullFileName);
|
||||
|
||||
#endif // DEF_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user