Suchen in Dateien hinzugefügt
This commit is contained in:
@@ -35,6 +35,12 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
{
|
||||
m_projectManager->openProject(lastPath);
|
||||
}
|
||||
|
||||
// Letzte Session wiederherstellen (geöffnete Dateien + aktiver Tab)
|
||||
m_editor->restoreSession(
|
||||
m_settings->lastOpenFiles(),
|
||||
m_settings->lastActiveFile()
|
||||
);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() = default;
|
||||
@@ -110,6 +116,9 @@ void MainWindow::setupMenuBar()
|
||||
m_actSearch = mBearbeiten->addAction(tr("&Suchen / Ersetzen…"), this, &MainWindow::onShowSearch);
|
||||
m_actSearch->setShortcut(QKeySequence::Find);
|
||||
|
||||
m_actFileSearch = mBearbeiten->addAction(tr("In &Dateien suchen…"), this, &MainWindow::onShowFileSearch);
|
||||
m_actFileSearch->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_F);
|
||||
|
||||
// ---- Ansicht ----
|
||||
QMenu *mAnsicht = menuBar()->addMenu(tr("&Ansicht"));
|
||||
|
||||
@@ -272,10 +281,16 @@ void MainWindow::onAbout()
|
||||
// ---------------------------------------------------------------------------
|
||||
// Slots – Projekt
|
||||
// ---------------------------------------------------------------------------
|
||||
void MainWindow::onShowFileSearch()
|
||||
{
|
||||
m_editor->showFileSearchPanel();
|
||||
}
|
||||
|
||||
void MainWindow::onProjectOpened(const QString &path)
|
||||
{
|
||||
setWindowTitle(QString("BareCode – %1").arg(path));
|
||||
m_fileTree->setRootPath(path);
|
||||
m_editor->setSearchRoot(path);
|
||||
statusBar()->showMessage(tr("Projekt geöffnet: %1").arg(path), 4000);
|
||||
}
|
||||
|
||||
@@ -283,6 +298,7 @@ void MainWindow::onProjectClosed()
|
||||
{
|
||||
setWindowTitle("BareCode");
|
||||
m_fileTree->clearRoot();
|
||||
m_editor->setSearchRoot(QString());
|
||||
statusBar()->showMessage(tr("Projekt geschlossen"), 3000);
|
||||
}
|
||||
|
||||
@@ -294,6 +310,10 @@ void MainWindow::saveWindowState()
|
||||
QSettings s(QSettings::IniFormat, QSettings::UserScope, "BareCode", "BareCode");
|
||||
s.setValue("window/geometry", saveGeometry());
|
||||
s.setValue("window/state", saveState());
|
||||
|
||||
// Session speichern
|
||||
m_settings->setLastOpenFiles(m_editor->openFilePaths());
|
||||
m_settings->setLastActiveFile(m_editor->activeFilePath());
|
||||
}
|
||||
|
||||
void MainWindow::restoreWindowState()
|
||||
|
||||
@@ -41,6 +41,7 @@ private slots:
|
||||
void onUndo();
|
||||
void onRedo();
|
||||
void onShowSearch();
|
||||
void onShowFileSearch();
|
||||
// Ansicht
|
||||
void onToggleDarkMode(bool checked);
|
||||
// Hilfe
|
||||
@@ -80,6 +81,7 @@ private:
|
||||
QAction *m_actUndo = nullptr;
|
||||
QAction *m_actRedo = nullptr;
|
||||
QAction *m_actSearch = nullptr;
|
||||
QAction *m_actFileSearch = nullptr;
|
||||
QAction *m_actDarkMode = nullptr;
|
||||
QAction *m_actAbout = nullptr;
|
||||
};
|
||||
|
||||
@@ -88,3 +88,26 @@ void Settings::setLastProjectPath(const QString &path)
|
||||
{
|
||||
m_settings.setValue("project/lastPath", path);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Session – geöffnete Dateien
|
||||
// ---------------------------------------------------------------------------
|
||||
QStringList Settings::lastOpenFiles() const
|
||||
{
|
||||
return m_settings.value("session/openFiles", QStringList()).toStringList();
|
||||
}
|
||||
|
||||
void Settings::setLastOpenFiles(const QStringList &files)
|
||||
{
|
||||
m_settings.setValue("session/openFiles", files);
|
||||
}
|
||||
|
||||
QString Settings::lastActiveFile() const
|
||||
{
|
||||
return m_settings.value("session/activeFile", QString()).toString();
|
||||
}
|
||||
|
||||
void Settings::setLastActiveFile(const QString &file)
|
||||
{
|
||||
m_settings.setValue("session/activeFile", file);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,13 @@ public:
|
||||
int fileTreeWidth() const;
|
||||
void setFileTreeWidth(int width);
|
||||
|
||||
// Zuletzt geöffnete Dateien (Session-Wiederherstellung)
|
||||
QStringList lastOpenFiles() const;
|
||||
void setLastOpenFiles(const QStringList &files);
|
||||
|
||||
QString lastActiveFile() const;
|
||||
void setLastActiveFile(const QString &file);
|
||||
|
||||
// Recent
|
||||
QString lastProjectPath() const;
|
||||
void setLastProjectPath(const QString &path);
|
||||
|
||||
Reference in New Issue
Block a user