80 lines
1.9 KiB
C++
80 lines
1.9 KiB
C++
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
// Copyright (C) 2026 Dany Thinnes
|
|
|
|
#pragma once
|
|
|
|
#include <QMainWindow>
|
|
#include <QSet>
|
|
|
|
#include "removable.h"
|
|
#include "xdftool.h"
|
|
|
|
class QAction;
|
|
class QCloseEvent;
|
|
class QFileSystemModel;
|
|
class QLabel;
|
|
class QLineEdit;
|
|
class QModelIndex;
|
|
class QPlainTextEdit;
|
|
class QPushButton;
|
|
class QTreeView;
|
|
class QTreeWidget;
|
|
class QTreeWidgetItem;
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
MainWindow();
|
|
void loadAdf(const QString &file);
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *e) override;
|
|
|
|
private slots:
|
|
void openAdf();
|
|
void reload();
|
|
void chooseLocalDir();
|
|
void localUp();
|
|
void localActivated(const QModelIndex &idx);
|
|
void adfActivated(QTreeWidgetItem *item, int column);
|
|
|
|
void adfToPc();
|
|
void pcToAdf();
|
|
void deleteSelected();
|
|
void renameSelected();
|
|
void makeDir();
|
|
void setToolPath();
|
|
void ejectDevice();
|
|
void showAbout();
|
|
|
|
private:
|
|
bool runBatch(const QList<QStringList> &cmds);
|
|
void showDir();
|
|
QList<QTreeWidgetItem *> selectedEntries() const;
|
|
void setLocalDir(const QString &dir);
|
|
void updateEjectState();
|
|
void updatePathLabel();
|
|
void log(const QString &text);
|
|
bool haveAdf();
|
|
|
|
XdfTool m_tool;
|
|
QString m_adf;
|
|
QString m_cwd; // aktueller Ordner in der ADF ("" = Wurzel)
|
|
QList<AdfEntry> m_entries; // kompletter Inhalt der ADF
|
|
QSet<QString> m_known; // alle Pfade (kleingeschrieben)
|
|
QSet<QString> m_dirs; // alle Ordnerpfade (kleingeschrieben)
|
|
QString m_localDir;
|
|
RemovableInfo m_removable;
|
|
|
|
QLabel *m_adfLabel = nullptr;
|
|
QLabel *m_cwdLabel = nullptr;
|
|
QPushButton *m_ejectBtn = nullptr;
|
|
QAction *m_ejectAct = nullptr;
|
|
QTreeWidget *m_adfTree = nullptr;
|
|
QLineEdit *m_localEdit = nullptr;
|
|
QTreeView *m_localView = nullptr;
|
|
QFileSystemModel *m_localModel = nullptr;
|
|
QPlainTextEdit *m_log = nullptr;
|
|
};
|