mirror of
https://github.com/opentx/opentx.git
synced 2025-07-13 19:40:20 +03:00
~ Move UI to new FileSyncDialog class; ~ Improve UI responsiveness during operation (closes #5005); + Add log verbosity option (also helps with UI response); + Add several filtering settings in new "extra options" panel (include/exlude patterns, symlinks, recursive, empty folders); ~ Exclude patterns ".*" and "System Volume*" by default (addresses #5213, #5106); + Sanity check file timestamps when using date comparison, future dates are invalid (addresses #5735); ~ Folders are no longer included in file counts (total/created/etc); ~ Ignore unreadable files/dirs (also enables NTFS permissions check); ~ Switch from QMutex to QReadWriteLock.
96 lines
3 KiB
C++
96 lines
3 KiB
C++
/*
|
|
* Copyright (C) OpenTX
|
|
*
|
|
* Based on code named
|
|
* th9x - http://code.google.com/p/th9x
|
|
* er9x - http://code.google.com/p/er9x
|
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
|
*
|
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program 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 for more details.
|
|
*/
|
|
|
|
#ifndef FILESYNCDIALOG_H
|
|
#define FILESYNCDIALOG_H
|
|
|
|
#include "process_sync.h"
|
|
|
|
#include <QDialog>
|
|
#include <QDialogButtonBox>
|
|
#include <QGroupBox>
|
|
#include <QLabel>
|
|
#include <QToolButton>
|
|
|
|
class ProgressWidget;
|
|
|
|
class FileSyncDialog : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(SyncProcess::SyncOptions syncOptions READ syncOptions WRITE setSyncOptions RESET resetOptions NOTIFY optionsWereReset)
|
|
Q_PROPERTY(bool extraOptionsVisible READ extraOptionsVisible WRITE toggleExtraOptions NOTIFY extraOptionsToggled)
|
|
Q_PROPERTY(QString folderNameA READ folderNameA WRITE setFolderNameA NOTIFY folderNameAChanged)
|
|
Q_PROPERTY(QString folderNameB READ folderNameB WRITE setFolderNameB NOTIFY folderNameBChanged)
|
|
|
|
public:
|
|
FileSyncDialog(QWidget * parent = nullptr, const SyncProcess::SyncOptions & syncOptions = SyncProcess::SyncOptions());
|
|
|
|
inline SyncProcess::SyncOptions syncOptions() const { return m_syncOptions; }
|
|
void setSyncOptions(const SyncProcess::SyncOptions & syncOptions);
|
|
void resetOptions();
|
|
|
|
inline bool extraOptionsVisible() const { return m_extraOptionsVisible; }
|
|
void toggleExtraOptions(bool show);
|
|
|
|
inline QString folderNameA() const { return m_folderNameA; }
|
|
void setFolderNameA(const QString & name);
|
|
|
|
inline QString folderNameB() const { return m_folderNameB; }
|
|
void setFolderNameB(const QString & name);
|
|
|
|
public slots:
|
|
virtual void reject() override;
|
|
void setStatusText(const QString & text, int type = QtWarningMsg);
|
|
bool validate();
|
|
|
|
signals:
|
|
void startSync();
|
|
void stopSync();
|
|
void folderNameAChanged(const QString & name);
|
|
void folderNameBChanged(const QString & name);
|
|
void extraOptionsToggled(bool show);
|
|
void optionsWereReset();
|
|
|
|
private slots:
|
|
void setupUi();
|
|
void toggleSync(bool);
|
|
void onSyncStarted();
|
|
void onSyncFinished();
|
|
void updateRunningState();
|
|
void onStatusUpdate(const SyncProcess::SyncStatus & stat);
|
|
void adjustSizeDelayed();
|
|
|
|
private:
|
|
SyncProcess::SyncOptions m_syncOptions;
|
|
QString m_folderNameA;
|
|
QString m_folderNameB;
|
|
bool m_running;
|
|
bool m_extraOptionsVisible;
|
|
|
|
QGroupBox * ui_optionsPanel;
|
|
QWidget * ui_extraOptions;
|
|
ProgressWidget * ui_progress;
|
|
QDialogButtonBox * ui_buttonBox;
|
|
QToolButton * ui_btnStartStop;
|
|
QToolButton * ui_btnClose;
|
|
QLabel * ui_statusLabel;
|
|
};
|
|
|
|
#endif // FILESYNCDIALOG_H
|