1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-07 06:54:40 +00:00
transmission/qt/OptionsDialog.h
Charles Kerr c2fb393390
chore: fix clang-tidy-11 warnings (#1436)
* refactor: mark subclass' destructors as override.

* refactor: use QUrl to parse announce URL strings.

The prompt for this was to work around a clang-tidy issue where
"char* host = nullptr;" triggers a "don't use varargs" warning,
but on the other hand it's also terser / cleaner.

* refactor: make the TorrentDelegate brushes const.

* refactor: s/auto/auto const*/ where appropriate

* chore: add some nonconst global warning exemptions

* chore: turn off warnings in GTest

* refactor: just disable the clang-tidy warning.

Apparently a std::array<T>::iterator is a T* on clang, since clang-tidy's
readability warning says we should use 'auto*' instead of 'auto'. However
adding that annotation fails on MSVC, where the is apparently _not_ a raw
pointer.

Since there's not a way to satisfy both of them at the same time, disable
the warning.
2020-09-09 09:24:39 -05:00

86 lines
1.8 KiB
C++

/*
* This file Copyright (C) 2009-2015 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.
*
*/
#pragma once
#include <QCryptographicHash>
#include <QDir>
#include <QFile>
#include <QMap>
#include <QString>
#include <QTimer>
#include <QVector>
#include "AddData.h" // AddData
#include "BaseDialog.h"
#include "Macros.h"
#include "Torrent.h" // FileList
#include "ui_OptionsDialog.h"
class Prefs;
class Session;
extern "C"
{
struct tr_variant;
}
class OptionsDialog : public BaseDialog
{
Q_OBJECT
TR_DISABLE_COPY_MOVE(OptionsDialog)
public:
OptionsDialog(Session& session, Prefs const& prefs, AddData addme, QWidget* parent = nullptr);
~OptionsDialog() override;
private:
using mybins_t = QMap<uint32_t, int32_t>;
private:
void reload();
void updateWidgetsLocality();
void clearInfo();
void clearVerify();
private slots:
void onAccepted();
void onPriorityChanged(QSet<int> const& file_indices, int);
void onWantedChanged(QSet<int> const& file_indices, bool);
void onVerify();
void onTimeout();
void onSourceChanged();
void onDestinationChanged();
void onSessionUpdated();
private:
AddData add_;
FileList files_;
QCryptographicHash verify_hash_;
QDir local_destination_;
QFile verify_file_;
QPushButton* verify_button_ = {};
QTimer edit_timer_;
QTimer verify_timer_;
QVector<bool> verify_flags_;
QVector<bool> wanted_;
QVector<int> priorities_;
Session& session_;
Ui::OptionsDialog ui_ = {};
mybins_t verify_bins_;
tr_info info_ = {};
uint64_t verify_file_pos_ = {};
uint32_t verify_piece_index_ = {};
uint32_t verify_piece_pos_ = {};
int verify_file_index_ = {};
char verify_buf_[2048 * 4] = {};
bool have_info_ = {};
bool is_local_ = {};
};