File indexing completed on 2024-12-01 07:38:58
0001 /*************************************************************************** 0002 * Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 0018 ***************************************************************************/ 0019 0020 #ifndef VERIFICATIONDIALOG_H 0021 #define VERIFICATIONDIALOG_H 0022 0023 #include "ui_verificationadddlg.h" 0024 #include "ui_verificationdialog.h" 0025 0026 #include "../core/basedialog.h" 0027 #include <QDialog> 0028 0029 class FileModel; 0030 class QSortFilterProxyModel; 0031 class TransferHandler; 0032 class Verifier; 0033 class VerificationModel; 0034 0035 class VerificationAddDlg : public QDialog 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 explicit VerificationAddDlg(VerificationModel *model, QWidget *parent = nullptr, Qt::WindowFlags flags = {}); 0041 0042 QSize sizeHint() const override; 0043 0044 private Q_SLOTS: 0045 void addChecksum(); 0046 void updateButton(); 0047 0048 private: 0049 Ui::VerificationAddDlg ui; 0050 VerificationModel *m_model = nullptr; 0051 QHash<QString, int> m_diggestLength; 0052 }; 0053 0054 class VerificationDialog : public KGetSaveSizeDialog 0055 { 0056 Q_OBJECT 0057 0058 public: 0059 VerificationDialog(QWidget *parent, TransferHandler *transfer, const QUrl &file); 0060 0061 QSize sizeHint() const override; 0062 0063 private Q_SLOTS: 0064 void fileFinished(const QUrl &file); 0065 void updateButtons(); 0066 void addClicked(); 0067 void removeClicked(); 0068 void verifyClicked(); 0069 void slotVerified(bool verified); 0070 void slotFinished(); 0071 0072 private: 0073 TransferHandler *m_transfer = nullptr; 0074 Verifier *m_verifier = nullptr; 0075 VerificationModel *m_model = nullptr; 0076 QSortFilterProxyModel *m_proxy = nullptr; 0077 FileModel *m_fileModel = nullptr; 0078 QModelIndex m_file; 0079 Ui::VerificationDialog ui; 0080 }; 0081 0082 #endif // VERIFICATIONDIALOG_H