Improve for recent files list. Show duplicate file names with unique path
section. --HG-- branch : develop
This commit is contained in:
parent
880aa4de0c
commit
93910a2130
|
@ -30,6 +30,7 @@
|
||||||
- All intersections are now treaded as a loop.
|
- All intersections are now treaded as a loop.
|
||||||
- [#558] New export: Export pattern as step-by-step text.
|
- [#558] New export: Export pattern as step-by-step text.
|
||||||
- Added options to control passmark angle type and passmark mark type.
|
- Added options to control passmark angle type and passmark mark type.
|
||||||
|
- Improve for recent files list. Show duplicate file names with unique path section.
|
||||||
|
|
||||||
# Version 0.6.2 (unreleased)
|
# Version 0.6.2 (unreleased)
|
||||||
- [#903] Bug in tool Cut Spline path.
|
- [#903] Bug in tool Cut Spline path.
|
||||||
|
|
|
@ -104,8 +104,6 @@ TMainWindow::TMainWindow(QWidget *parent)
|
||||||
labelPatternUnit(nullptr),
|
labelPatternUnit(nullptr),
|
||||||
isInitialized(false),
|
isInitialized(false),
|
||||||
mIsReadOnly(false),
|
mIsReadOnly(false),
|
||||||
recentFileActs(QVector<QAction *>(MaxRecentFiles)),
|
|
||||||
separatorAct(nullptr),
|
|
||||||
hackedWidgets()
|
hackedWidgets()
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -127,7 +125,7 @@ TMainWindow::TMainWindow(QWidget *parent)
|
||||||
ui->mainToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
|
ui->mainToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
|
||||||
ui->toolBarGradation->setContextMenuPolicy(Qt::PreventContextMenu);
|
ui->toolBarGradation->setContextMenuPolicy(Qt::PreventContextMenu);
|
||||||
|
|
||||||
recentFileActs.fill(nullptr);
|
m_recentFileActs.fill(nullptr);
|
||||||
|
|
||||||
SetupMenu();
|
SetupMenu();
|
||||||
UpdateWindowTitle();
|
UpdateWindowTitle();
|
||||||
|
@ -689,6 +687,12 @@ void TMainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int
|
||||||
csv.toCSV(fileName, error, withHeader, separator, QTextCodec::codecForMib(mib));
|
csv.toCSV(fileName, error, withHeader, separator, QTextCodec::codecForMib(mib));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QStringList TMainWindow::RecentFileList() const
|
||||||
|
{
|
||||||
|
return qApp->TapeSettings()->GetRecentFileList();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool TMainWindow::FileSave()
|
bool TMainWindow::FileSave()
|
||||||
{
|
{
|
||||||
|
@ -1940,7 +1944,7 @@ void TMainWindow::SetupMenu()
|
||||||
});
|
});
|
||||||
connect(ui->actionPreferences, &QAction::triggered, this, &TMainWindow::Preferences);
|
connect(ui->actionPreferences, &QAction::triggered, this, &TMainWindow::Preferences);
|
||||||
|
|
||||||
for (auto & recentFileAct : recentFileActs)
|
for (auto & recentFileAct : m_recentFileActs)
|
||||||
{
|
{
|
||||||
auto *action = new QAction(this);
|
auto *action = new QAction(this);
|
||||||
recentFileAct = action;
|
recentFileAct = action;
|
||||||
|
@ -1959,10 +1963,10 @@ void TMainWindow::SetupMenu()
|
||||||
recentFileAct->setVisible(false);
|
recentFileAct->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
separatorAct = new QAction(this);
|
m_separatorAct = new QAction(this);
|
||||||
separatorAct->setSeparator(true);
|
m_separatorAct->setSeparator(true);
|
||||||
separatorAct->setVisible(false);
|
m_separatorAct->setVisible(false);
|
||||||
ui->menuFile->insertAction(ui->actionPreferences, separatorAct );
|
ui->menuFile->insertAction(ui->actionPreferences, m_separatorAct );
|
||||||
|
|
||||||
|
|
||||||
connect(ui->actionQuit, &QAction::triggered, this, &TMainWindow::close);
|
connect(ui->actionQuit, &QAction::triggered, this, &TMainWindow::close);
|
||||||
|
@ -2916,25 +2920,6 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TMainWindow::UpdateRecentFileActions()
|
|
||||||
{
|
|
||||||
qCDebug(tMainWindow, "Updating recent file actions.");
|
|
||||||
const QStringList files = qApp->TapeSettings()->GetRecentFileList();
|
|
||||||
const int numRecentFiles = qMin(files.size(), static_cast<int>(MaxRecentFiles));
|
|
||||||
qCDebug(tMainWindow, "Updating recent file actions = %i ",numRecentFiles);
|
|
||||||
|
|
||||||
for (int i = 0; i < numRecentFiles; ++i)
|
|
||||||
{
|
|
||||||
const QString text = QStringLiteral("&%1. %2").arg(i + 1).arg(StrippedName(files.at(i)));
|
|
||||||
qCDebug(tMainWindow, "file %i = %s", numRecentFiles, qUtf8Printable(text));
|
|
||||||
recentFileActs.at(i)->setText(text);
|
|
||||||
recentFileActs.at(i)->setData(files.at(i));
|
|
||||||
recentFileActs.at(i)->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
separatorAct->setVisible(numRecentFiles>0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::CreateWindowMenu(QMenu *menu)
|
void TMainWindow::CreateWindowMenu(QMenu *menu)
|
||||||
|
|
|
@ -72,6 +72,7 @@ protected:
|
||||||
virtual bool eventFilter(QObject *object, QEvent *event) override;
|
virtual bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib,
|
virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib,
|
||||||
const QChar &separator) final;
|
const QChar &separator) final;
|
||||||
|
virtual QStringList RecentFileList() const override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void FileNew();
|
void FileNew();
|
||||||
|
@ -148,9 +149,7 @@ private:
|
||||||
QLabel *labelPatternUnit;
|
QLabel *labelPatternUnit;
|
||||||
bool isInitialized;
|
bool isInitialized;
|
||||||
bool mIsReadOnly;
|
bool mIsReadOnly;
|
||||||
enum { MaxRecentFiles = 5 };
|
|
||||||
QVector<QAction *> recentFileActs;
|
|
||||||
QAction *separatorAct;
|
|
||||||
QVector<QObject *> hackedWidgets;
|
QVector<QObject *> hackedWidgets;
|
||||||
|
|
||||||
void SetupMenu();
|
void SetupMenu();
|
||||||
|
@ -164,7 +163,6 @@ private:
|
||||||
void ShowNewMData(bool fresh);
|
void ShowNewMData(bool fresh);
|
||||||
void ShowUnits();
|
void ShowUnits();
|
||||||
void ShowHeaderUnits(QTableWidget *table, int column, const QString &unit);
|
void ShowHeaderUnits(QTableWidget *table, int column, const QString &unit);
|
||||||
void UpdateRecentFileActions();
|
|
||||||
|
|
||||||
void MeasurementsWereSaved(bool saved);
|
void MeasurementsWereSaved(bool saved);
|
||||||
void SetCurrentFile(const QString &fileName);
|
void SetCurrentFile(const QString &fileName);
|
||||||
|
|
|
@ -176,8 +176,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
currentDrawIndex(0), currentToolBoxIndex(0),
|
currentDrawIndex(0), currentToolBoxIndex(0),
|
||||||
isDockToolOptionsVisible(true),
|
isDockToolOptionsVisible(true),
|
||||||
isDockGroupsVisible(true),
|
isDockGroupsVisible(true),
|
||||||
drawMode(true), recentFileActs(),
|
drawMode(true),
|
||||||
separatorAct(nullptr),
|
|
||||||
leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true),
|
leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true),
|
||||||
gradationHeights(nullptr),
|
gradationHeights(nullptr),
|
||||||
gradationSizes(nullptr),
|
gradationSizes(nullptr),
|
||||||
|
@ -193,11 +192,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
m_progressBar(new QProgressBar(this)),
|
m_progressBar(new QProgressBar(this)),
|
||||||
m_statusLabel(new QLabel(this))
|
m_statusLabel(new QLabel(this))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MaxRecentFiles; ++i)
|
|
||||||
{
|
|
||||||
recentFileActs[i] = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateActions();
|
CreateActions();
|
||||||
InitScenes();
|
InitScenes();
|
||||||
|
|
||||||
|
@ -4011,38 +4005,16 @@ bool MainWindow::MaybeSave()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void MainWindow::UpdateRecentFileActions()
|
|
||||||
{
|
|
||||||
qCDebug(vMainWindow, "Updating recent file actions.");
|
|
||||||
const QStringList files = qApp->ValentinaSettings()->GetRecentFileList();
|
|
||||||
const int numRecentFiles = qMin(files.size(), static_cast<int>(MaxRecentFiles));
|
|
||||||
|
|
||||||
for (int i = 0; i < numRecentFiles; ++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);
|
|
||||||
}
|
|
||||||
for (int j = numRecentFiles; j < MaxRecentFiles; ++j)
|
|
||||||
{
|
|
||||||
recentFileActs[j]->setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
separatorAct->setVisible(numRecentFiles > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::CreateMenus()
|
void MainWindow::CreateMenus()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MaxRecentFiles; ++i)
|
for (int i = 0; i < MaxRecentFiles; ++i)
|
||||||
{
|
{
|
||||||
ui->menuFile->insertAction(ui->actionPreferences, recentFileActs[i]);
|
ui->menuFile->insertAction(ui->actionPreferences, m_recentFileActs.at(i));
|
||||||
}
|
}
|
||||||
separatorAct = new QAction(this);
|
m_separatorAct = new QAction(this);
|
||||||
separatorAct->setSeparator(true);
|
m_separatorAct->setSeparator(true);
|
||||||
ui->menuFile->insertAction(ui->actionPreferences, separatorAct);
|
ui->menuFile->insertAction(ui->actionPreferences, m_separatorAct);
|
||||||
UpdateRecentFileActions();
|
UpdateRecentFileActions();
|
||||||
|
|
||||||
//Add Undo/Redo actions.
|
//Add Undo/Redo actions.
|
||||||
|
@ -4060,9 +4032,9 @@ void MainWindow::CreateMenus()
|
||||||
ui->menuPatternPiece->insertAction(ui->actionLast_tool, redoAction);
|
ui->menuPatternPiece->insertAction(ui->actionLast_tool, redoAction);
|
||||||
ui->toolBarTools->addAction(redoAction);
|
ui->toolBarTools->addAction(redoAction);
|
||||||
|
|
||||||
separatorAct = new QAction(this);
|
m_separatorAct = new QAction(this);
|
||||||
separatorAct->setSeparator(true);
|
m_separatorAct->setSeparator(true);
|
||||||
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, separatorAct);
|
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, m_separatorAct);
|
||||||
|
|
||||||
AddDocks();
|
AddDocks();
|
||||||
}
|
}
|
||||||
|
@ -4559,8 +4531,8 @@ void MainWindow::CreateActions()
|
||||||
{
|
{
|
||||||
QAction *action = new QAction(this);
|
QAction *action = new QAction(this);
|
||||||
action->setVisible(false);
|
action->setVisible(false);
|
||||||
recentFileActs[i] = action;
|
m_recentFileActs[i] = action;
|
||||||
connect(recentFileActs[i], &QAction::triggered, this, [this]()
|
connect(m_recentFileActs[i], &QAction::triggered, this, [this]()
|
||||||
{
|
{
|
||||||
if (QAction *action = qobject_cast<QAction*>(sender()))
|
if (QAction *action = qobject_cast<QAction*>(sender()))
|
||||||
{
|
{
|
||||||
|
|
|
@ -255,9 +255,6 @@ private:
|
||||||
/** @brief drawMode true if we current draw scene. */
|
/** @brief drawMode true if we current draw scene. */
|
||||||
bool drawMode;
|
bool drawMode;
|
||||||
|
|
||||||
enum { MaxRecentFiles = 5 };
|
|
||||||
QAction *recentFileActs[MaxRecentFiles];
|
|
||||||
QAction *separatorAct;
|
|
||||||
QLabel *leftGoToStage;
|
QLabel *leftGoToStage;
|
||||||
QLabel *rightGoToStage;
|
QLabel *rightGoToStage;
|
||||||
QTimer *autoSaveTimer;
|
QTimer *autoSaveTimer;
|
||||||
|
@ -326,7 +323,6 @@ private:
|
||||||
void WriteSettings();
|
void WriteSettings();
|
||||||
|
|
||||||
bool MaybeSave();
|
bool MaybeSave();
|
||||||
void UpdateRecentFileActions();
|
|
||||||
void CreateMenus();
|
void CreateMenus();
|
||||||
void CreateActions();
|
void CreateActions();
|
||||||
void InitAutoSave();
|
void InitAutoSave();
|
||||||
|
|
|
@ -1038,6 +1038,12 @@ void MainWindowsNoGUI::InitTempLayoutScene()
|
||||||
tempSceneLayout->setBackgroundBrush( QBrush(QColor(Qt::gray), Qt::SolidPattern) );
|
tempSceneLayout->setBackgroundBrush( QBrush(QColor(Qt::gray), Qt::SolidPattern) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QStringList MainWindowsNoGUI::RecentFileList() const
|
||||||
|
{
|
||||||
|
return qApp->ValentinaSettings()->GetRecentFileList();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QIcon MainWindowsNoGUI::ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const
|
QIcon MainWindowsNoGUI::ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -135,6 +135,7 @@ protected:
|
||||||
void InitTempLayoutScene();
|
void InitTempLayoutScene();
|
||||||
virtual void CleanLayout()=0;
|
virtual void CleanLayout()=0;
|
||||||
virtual void PrepareSceneList(PreviewQuatilty quality)=0;
|
virtual void PrepareSceneList(PreviewQuatilty quality)=0;
|
||||||
|
virtual QStringList RecentFileList() const override;
|
||||||
QIcon ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const;
|
QIcon ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const;
|
||||||
bool GenerateLayout(VLayoutGenerator& lGenerator);
|
bool GenerateLayout(VLayoutGenerator& lGenerator);
|
||||||
int ContinueIfLayoutStale();
|
int ContinueIfLayoutStale();
|
||||||
|
|
|
@ -40,11 +40,137 @@
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QStringList SplitFilePaths(const QString &path)
|
||||||
|
{
|
||||||
|
QStringList result;
|
||||||
|
QString subPath = QDir::cleanPath(path);
|
||||||
|
QString lastFileName;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
QFileInfo fileInfo(subPath);
|
||||||
|
lastFileName = fileInfo.fileName();
|
||||||
|
if (not lastFileName.isEmpty())
|
||||||
|
{
|
||||||
|
result.prepend(lastFileName);
|
||||||
|
subPath = fileInfo.path();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(not lastFileName.isEmpty());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QStringList ReverseList(const QStringList &list)
|
||||||
|
{
|
||||||
|
if (list.isEmpty())
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
QVector<QString> reversedList(list.size());
|
||||||
|
qint32 j = 0;
|
||||||
|
for (qint32 i = list.size() - 1; i >= 0; --i)
|
||||||
|
{
|
||||||
|
reversedList.replace(j, list.at(i));
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
return reversedList.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QStringList SelectNumber(QStringList path, int number)
|
||||||
|
{
|
||||||
|
path = ReverseList(path);
|
||||||
|
QStringList subPath = path.mid(0, number);
|
||||||
|
return ReverseList(subPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QStringList RecentFiles(const QStringList &paths)
|
||||||
|
{
|
||||||
|
QVector<QStringList> table;
|
||||||
|
table.reserve(paths.size());
|
||||||
|
|
||||||
|
for(auto &path : paths)
|
||||||
|
{
|
||||||
|
table.append(SplitFilePaths(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
auto CreateOptimized = [table](int tableRow)
|
||||||
|
{
|
||||||
|
QStringList optimized;
|
||||||
|
bool isUnique = true;
|
||||||
|
|
||||||
|
QStringList path = table.at(tableRow);
|
||||||
|
for (int count = 1; count <= path.size(); ++count)
|
||||||
|
{
|
||||||
|
isUnique = true;
|
||||||
|
optimized = SelectNumber(path, count);
|
||||||
|
|
||||||
|
for (int row = 0; row < table.size(); ++row)
|
||||||
|
{
|
||||||
|
if (row == tableRow)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList testSubPath = SelectNumber(table.at(row), count);
|
||||||
|
if (optimized.join(QDir::separator()) == testSubPath.join(QDir::separator()))
|
||||||
|
{
|
||||||
|
isUnique = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isUnique)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optimized.size() >= 3)
|
||||||
|
{
|
||||||
|
optimized = QStringList({optimized.first(), QStringLiteral("…"), optimized.last()});
|
||||||
|
}
|
||||||
|
|
||||||
|
return optimized;
|
||||||
|
};
|
||||||
|
|
||||||
|
QVector<QStringList> optimizedPaths;
|
||||||
|
optimizedPaths.reserve(paths.size());
|
||||||
|
|
||||||
|
for (int row = 0; row < table.size(); ++row)
|
||||||
|
{
|
||||||
|
optimizedPaths.append(CreateOptimized(row));
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList recentFiles;
|
||||||
|
recentFiles.reserve(paths.size());
|
||||||
|
|
||||||
|
for(auto &path : optimizedPaths)
|
||||||
|
{
|
||||||
|
recentFiles.append(path.join(QDir::separator()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return recentFiles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractMainWindow::VAbstractMainWindow(QWidget *parent)
|
VAbstractMainWindow::VAbstractMainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
m_curFileFormatVersion(0x0),
|
m_curFileFormatVersion(0x0),
|
||||||
m_curFileFormatVersionStr(QLatin1String("0.0.0"))
|
m_curFileFormatVersionStr(QLatin1String("0.0.0"))
|
||||||
{}
|
{
|
||||||
|
for (int i = 0; i < MaxRecentFiles; ++i)
|
||||||
|
{
|
||||||
|
m_recentFileActs[i] = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VAbstractMainWindow::ContinueFormatRewrite(const QString ¤tFormatVersion,
|
bool VAbstractMainWindow::ContinueFormatRewrite(const QString ¤tFormatVersion,
|
||||||
|
@ -126,6 +252,28 @@ QString VAbstractMainWindow::CSVFilePath()
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractMainWindow::UpdateRecentFileActions()
|
||||||
|
{
|
||||||
|
const QStringList files = RecentFileList();
|
||||||
|
const QStringList recentFiles = RecentFiles(files);
|
||||||
|
const int numRecentFiles = qMin(files.size(), static_cast<int>(MaxRecentFiles));
|
||||||
|
|
||||||
|
for (int i = 0; i < numRecentFiles; ++i)
|
||||||
|
{
|
||||||
|
QString recent = recentFiles.at(i);
|
||||||
|
if (not recent.isEmpty())
|
||||||
|
{
|
||||||
|
const QString text = QStringLiteral("&%1. %2").arg(i + 1).arg(recentFiles.at(i));
|
||||||
|
m_recentFileActs.at(i)->setText(text);
|
||||||
|
m_recentFileActs.at(i)->setData(files.at(i));
|
||||||
|
m_recentFileActs.at(i)->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_separatorAct->setVisible(numRecentFiles>0);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractMainWindow::WindowsLocale()
|
void VAbstractMainWindow::WindowsLocale()
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,6 +57,9 @@ protected slots:
|
||||||
protected:
|
protected:
|
||||||
int m_curFileFormatVersion;
|
int m_curFileFormatVersion;
|
||||||
QString m_curFileFormatVersionStr;
|
QString m_curFileFormatVersionStr;
|
||||||
|
enum { MaxRecentFiles = 5 };
|
||||||
|
QVector<QAction *> m_recentFileActs{QVector<QAction *>(MaxRecentFiles)};
|
||||||
|
QAction *m_separatorAct{nullptr};
|
||||||
|
|
||||||
bool ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion);
|
bool ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion);
|
||||||
void ToolBarStyle(QToolBar *bar);
|
void ToolBarStyle(QToolBar *bar);
|
||||||
|
@ -65,6 +68,9 @@ protected:
|
||||||
|
|
||||||
virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator)=0;
|
virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator)=0;
|
||||||
|
|
||||||
|
virtual QStringList RecentFileList() const =0;
|
||||||
|
void UpdateRecentFileActions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VAbstractMainWindow)
|
Q_DISABLE_COPY(VAbstractMainWindow)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user