Files
ResInsight/ApplicationLibCode/UserInterface/RiuRecentFileActionProvider.h
T
Magne Sjaastad 56ff80c8e2 #13360: Integrate project version restore tool into GUI
Add a GUI feature for restoring previous versions of a project file from
its backup database, replacing the need for the external standalone tool.

- RiaProjectBackupTools: add extractVersionsToFolder() to read all stored
  revisions from a project's .rspdb backup database and write each one to
  a timestamped .rsp file in a destination folder.
- RicRestoreProjectVersionsUi: dialog for selecting the project file and
  export folder, defaulting to the currently open project. Adds a Recent
  Project Files dropdown (backed by RiuRecentFileActionProvider) that
  quickly populates the project file and export folder fields.
- RicRestoreProjectVersionsFeature: new command feature wired into the
  File menu as 'Restore Previous Project Versions...', using the
  OpenFolder icon and placed after a separator below Save Project / Save
  Project As.
- RiuRecentFileActionProvider: add recentProjectFiles() to expose the
  list of recently used project files.
- Added '...' suffix to Save Project As, consistent with other
  dialog-launching actions.
2026-10-21 22:23:38 +02:00

64 lines
1.8 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA 2016
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QObject>
#include <QString>
#include <QStringList>
#include <vector>
class QAction;
//==================================================================================================
//
//
//
//==================================================================================================
class RiuRecentFileActionProvider : public QObject
{
Q_OBJECT
public:
explicit RiuRecentFileActionProvider( int maxActionCount = 9 );
~RiuRecentFileActionProvider() override;
void addFileName( const QString& fileName );
std::vector<QAction*> actions() const;
static QString lastUsedProjectFileName();
static QStringList recentProjectFiles();
private slots:
void slotOpenRecentFile();
private:
void createActions();
void updateActions();
void removeFileName( const QString& fileName );
static QString registryKey();
private:
int m_maxActionCount;
std::vector<QAction*> m_recentFileActions;
QAction* m_separatorAction;
};