mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Merge pull request #17416 from Chocobo1/icon
Split code to smaller functions
This commit is contained in:
commit
36bc77e2e2
@ -70,6 +70,7 @@ class FileSystemPathEdit::FileSystemPathEditPrivate
|
|||||||
Q_DECLARE_PUBLIC(FileSystemPathEdit)
|
Q_DECLARE_PUBLIC(FileSystemPathEdit)
|
||||||
Q_DISABLE_COPY_MOVE(FileSystemPathEditPrivate)
|
Q_DISABLE_COPY_MOVE(FileSystemPathEditPrivate)
|
||||||
|
|
||||||
|
private:
|
||||||
FileSystemPathEditPrivate(FileSystemPathEdit *q, Private::IFileEditorWithCompletion *editor);
|
FileSystemPathEditPrivate(FileSystemPathEdit *q, Private::IFileEditorWithCompletion *editor);
|
||||||
|
|
||||||
void modeChanged();
|
void modeChanged();
|
||||||
@ -81,7 +82,7 @@ class FileSystemPathEdit::FileSystemPathEditPrivate
|
|||||||
QAction *m_browseAction = nullptr;
|
QAction *m_browseAction = nullptr;
|
||||||
QToolButton *m_browseBtn = nullptr;
|
QToolButton *m_browseBtn = nullptr;
|
||||||
QString m_fileNameFilter;
|
QString m_fileNameFilter;
|
||||||
Mode m_mode;
|
Mode m_mode = FileSystemPathEdit::Mode::FileOpen;
|
||||||
Path m_lastSignaledPath;
|
Path m_lastSignaledPath;
|
||||||
QString m_dialogCaption;
|
QString m_dialogCaption;
|
||||||
Private::FileSystemPathValidator *m_validator = nullptr;
|
Private::FileSystemPathValidator *m_validator = nullptr;
|
||||||
@ -91,20 +92,22 @@ FileSystemPathEdit::FileSystemPathEditPrivate::FileSystemPathEditPrivate(
|
|||||||
FileSystemPathEdit *q, Private::IFileEditorWithCompletion *editor)
|
FileSystemPathEdit *q, Private::IFileEditorWithCompletion *editor)
|
||||||
: q_ptr {q}
|
: q_ptr {q}
|
||||||
, m_editor {editor}
|
, m_editor {editor}
|
||||||
, m_browseAction {new QAction(q)}
|
, m_browseAction {new QAction(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon), browseButtonFullText.tr(), q)}
|
||||||
, m_browseBtn {new QToolButton(q)}
|
, m_browseBtn {new QToolButton(q)}
|
||||||
, m_mode {FileSystemPathEdit::Mode::FileOpen}
|
, m_fileNameFilter {tr("Any file") + u" (*)"}
|
||||||
, m_validator {new Private::FileSystemPathValidator(q)}
|
, m_validator {new Private::FileSystemPathValidator(q)}
|
||||||
{
|
{
|
||||||
m_browseAction->setIconText(browseButtonBriefText.tr());
|
m_browseAction->setIconText(browseButtonBriefText.tr());
|
||||||
m_browseAction->setText(browseButtonFullText.tr());
|
|
||||||
m_browseAction->setToolTip(browseButtonFullText.tr().remove(u'&'));
|
|
||||||
m_browseAction->setShortcut(Qt::CTRL + Qt::Key_B);
|
m_browseAction->setShortcut(Qt::CTRL + Qt::Key_B);
|
||||||
|
m_browseAction->setToolTip(browseButtonFullText.tr().remove(u'&'));
|
||||||
|
|
||||||
m_browseBtn->setDefaultAction(m_browseAction);
|
m_browseBtn->setDefaultAction(m_browseAction);
|
||||||
m_fileNameFilter = tr("Any file") + u" (*)";
|
|
||||||
m_editor->setBrowseAction(m_browseAction);
|
|
||||||
m_validator->setStrictMode(false);
|
m_validator->setStrictMode(false);
|
||||||
|
|
||||||
|
m_editor->setBrowseAction(m_browseAction);
|
||||||
m_editor->setValidator(m_validator);
|
m_editor->setValidator(m_validator);
|
||||||
|
|
||||||
modeChanged();
|
modeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,22 +163,7 @@ QString FileSystemPathEdit::FileSystemPathEditPrivate::dialogCaptionOrDefault()
|
|||||||
|
|
||||||
void FileSystemPathEdit::FileSystemPathEditPrivate::modeChanged()
|
void FileSystemPathEdit::FileSystemPathEditPrivate::modeChanged()
|
||||||
{
|
{
|
||||||
bool showDirsOnly = false;
|
m_editor->completeDirectoriesOnly((m_mode == FileSystemPathEdit::Mode::DirectoryOpen) || (m_mode == FileSystemPathEdit::Mode::DirectorySave));
|
||||||
switch (m_mode)
|
|
||||||
{
|
|
||||||
case FileSystemPathEdit::Mode::FileOpen:
|
|
||||||
case FileSystemPathEdit::Mode::FileSave:
|
|
||||||
showDirsOnly = false;
|
|
||||||
break;
|
|
||||||
case FileSystemPathEdit::Mode::DirectoryOpen:
|
|
||||||
case FileSystemPathEdit::Mode::DirectorySave:
|
|
||||||
showDirsOnly = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw std::logic_error("Unknown FileSystemPathEdit mode");
|
|
||||||
}
|
|
||||||
m_browseAction->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon));
|
|
||||||
m_editor->completeDirectoriesOnly(showDirsOnly);
|
|
||||||
|
|
||||||
m_validator->setExistingOnly(m_mode != FileSystemPathEdit::Mode::FileSave);
|
m_validator->setExistingOnly(m_mode != FileSystemPathEdit::Mode::FileSave);
|
||||||
m_validator->setDirectoriesOnly((m_mode == FileSystemPathEdit::Mode::DirectoryOpen) || (m_mode == FileSystemPathEdit::Mode::DirectorySave));
|
m_validator->setDirectoriesOnly((m_mode == FileSystemPathEdit::Mode::DirectoryOpen) || (m_mode == FileSystemPathEdit::Mode::DirectorySave));
|
||||||
@ -297,10 +285,10 @@ FileSystemPathEdit::Mode FileSystemPathEdit::mode() const
|
|||||||
return d->m_mode;
|
return d->m_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemPathEdit::setMode(FileSystemPathEdit::Mode theMode)
|
void FileSystemPathEdit::setMode(const Mode mode)
|
||||||
{
|
{
|
||||||
Q_D(FileSystemPathEdit);
|
Q_D(FileSystemPathEdit);
|
||||||
d->m_mode = theMode;
|
d->m_mode = mode;
|
||||||
d->modeChanged();
|
d->modeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -103,19 +103,45 @@ private slots:
|
|||||||
void on_addWatchedFolderButton_clicked();
|
void on_addWatchedFolderButton_clicked();
|
||||||
void on_editWatchedFolderButton_clicked();
|
void on_editWatchedFolderButton_clicked();
|
||||||
void on_removeWatchedFolderButton_clicked();
|
void on_removeWatchedFolderButton_clicked();
|
||||||
void on_registerDNSBtn_clicked();
|
|
||||||
void setLocale(const QString &localeStr);
|
void setLocale(const QString &localeStr);
|
||||||
|
|
||||||
|
#ifndef DISABLE_WEBUI
|
||||||
void webUIHttpsCertChanged(const Path &path);
|
void webUIHttpsCertChanged(const Path &path);
|
||||||
void webUIHttpsKeyChanged(const Path &path);
|
void webUIHttpsKeyChanged(const Path &path);
|
||||||
|
void on_registerDNSBtn_clicked();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void showEvent(QShowEvent *e) override;
|
void showEvent(QShowEvent *e) override;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void saveOptions();
|
void saveOptions() const;
|
||||||
void loadOptions();
|
|
||||||
void initializeLanguageCombo();
|
void loadBehaviorTabOptions();
|
||||||
|
void saveBehaviorTabOptions() const;
|
||||||
|
|
||||||
|
void loadDownloadsTabOptions();
|
||||||
|
void saveDownloadsTabOptions() const;
|
||||||
|
|
||||||
|
void loadConnectionTabOptions();
|
||||||
|
void saveConnectionTabOptions() const;
|
||||||
|
|
||||||
|
void loadSpeedTabOptions();
|
||||||
|
void saveSpeedTabOptions() const;
|
||||||
|
|
||||||
|
void loadBittorrentTabOptions();
|
||||||
|
void saveBittorrentTabOptions() const;
|
||||||
|
|
||||||
|
void loadRSSTabOptions();
|
||||||
|
void saveRSSTabOptions() const;
|
||||||
|
|
||||||
|
#ifndef DISABLE_WEBUI
|
||||||
|
void loadWebUITabOptions();
|
||||||
|
void saveWebUITabOptions() const;
|
||||||
|
#endif // DISABLE_WEBUI
|
||||||
|
|
||||||
// General options
|
// General options
|
||||||
|
void initializeLanguageCombo();
|
||||||
QString getLocale() const;
|
QString getLocale() const;
|
||||||
bool startMinimized() const;
|
bool startMinimized() const;
|
||||||
bool isSplashScreenDisabled() const;
|
bool isSplashScreenDisabled() const;
|
||||||
@ -158,11 +184,13 @@ private:
|
|||||||
int getMaxActiveUploads() const;
|
int getMaxActiveUploads() const;
|
||||||
int getMaxActiveTorrents() const;
|
int getMaxActiveTorrents() const;
|
||||||
// WebUI
|
// WebUI
|
||||||
|
#ifndef DISABLE_WEBUI
|
||||||
bool isWebUiEnabled() const;
|
bool isWebUiEnabled() const;
|
||||||
QString webUiUsername() const;
|
QString webUiUsername() const;
|
||||||
QString webUiPassword() const;
|
QString webUiPassword() const;
|
||||||
bool webUIAuthenticationOk();
|
bool webUIAuthenticationOk();
|
||||||
bool isAlternativeWebUIPathValid();
|
bool isAlternativeWebUIPathValid();
|
||||||
|
#endif
|
||||||
|
|
||||||
bool schedTimesOk();
|
bool schedTimesOk();
|
||||||
|
|
||||||
|
@ -199,6 +199,7 @@ TorrentContentModel::TorrentContentModel(QObject *parent)
|
|||||||
, m_fileIconProvider {doesQFileIconProviderWork() ? new QFileIconProvider : new MimeFileIconProvider}
|
, m_fileIconProvider {doesQFileIconProviderWork() ? new QFileIconProvider : new MimeFileIconProvider}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
m_fileIconProvider->setOptions(QFileIconProvider::DontUseCustomDirectoryIcons);
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentContentModel::~TorrentContentModel()
|
TorrentContentModel::~TorrentContentModel()
|
||||||
|
Loading…
Reference in New Issue
Block a user