mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-27 03:39:39 +03:00
Code formatting
Refactor
This commit is contained in:
parent
0939875ca8
commit
51e3e5438b
2 changed files with 116 additions and 113 deletions
|
@ -71,7 +71,7 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showAdvancedSettings(bool show);
|
void showAdvancedSettings(bool show);
|
||||||
void displayContentTreeMenu(const QPoint&);
|
void displayContentTreeMenu(const QPoint &);
|
||||||
void updateDiskSpaceLabel();
|
void updateDiskSpaceLabel();
|
||||||
void onSavePathChanged(int);
|
void onSavePathChanged(int);
|
||||||
void renameSelectedFile();
|
void renameSelectedFile();
|
||||||
|
@ -93,7 +93,7 @@ private:
|
||||||
bool loadMagnet(const BitTorrent::MagnetUri &magnetUri);
|
bool loadMagnet(const BitTorrent::MagnetUri &magnetUri);
|
||||||
void populateSavePathComboBox();
|
void populateSavePathComboBox();
|
||||||
void saveSavePathHistory() const;
|
void saveSavePathHistory() const;
|
||||||
int indexOfSavePath(const QString& save_path);
|
int indexOfSavePath(const QString &save_path);
|
||||||
void loadState();
|
void loadState();
|
||||||
void saveState();
|
void saveState();
|
||||||
void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = QString());
|
void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = QString());
|
||||||
|
|
|
@ -210,7 +210,7 @@ void PropertiesWidget::showPiecesDownloaded(bool show)
|
||||||
|
|
||||||
void PropertiesWidget::setVisibility(bool visible)
|
void PropertiesWidget::setVisibility(bool visible)
|
||||||
{
|
{
|
||||||
if (!visible && ( state == VISIBLE) ) {
|
if (!visible && (state == VISIBLE)) {
|
||||||
QSplitter *hSplitter = static_cast<QSplitter *>(parentWidget());
|
QSplitter *hSplitter = static_cast<QSplitter *>(parentWidget());
|
||||||
m_ui->stackedProperties->setVisible(false);
|
m_ui->stackedProperties->setVisible(false);
|
||||||
slideSizes = hSplitter->sizes();
|
slideSizes = hSplitter->sizes();
|
||||||
|
@ -222,7 +222,7 @@ void PropertiesWidget::setVisibility(bool visible)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visible && ( state == REDUCED) ) {
|
if (visible && (state == REDUCED)) {
|
||||||
m_ui->stackedProperties->setVisible(true);
|
m_ui->stackedProperties->setVisible(true);
|
||||||
QSplitter *hSplitter = static_cast<QSplitter *>(parentWidget());
|
QSplitter *hSplitter = static_cast<QSplitter *>(parentWidget());
|
||||||
hSplitter->handle(1)->setDisabled(false);
|
hSplitter->handle(1)->setDisabled(false);
|
||||||
|
@ -363,7 +363,7 @@ void PropertiesWidget::readSettings()
|
||||||
void PropertiesWidget::saveSettings()
|
void PropertiesWidget::saveSettings()
|
||||||
{
|
{
|
||||||
Preferences *const pref = Preferences::instance();
|
Preferences *const pref = Preferences::instance();
|
||||||
pref->setPropVisible(state==VISIBLE);
|
pref->setPropVisible(state == VISIBLE);
|
||||||
// Splitter sizes
|
// Splitter sizes
|
||||||
QSplitter *hSplitter = static_cast<QSplitter *>(parentWidget());
|
QSplitter *hSplitter = static_cast<QSplitter *>(parentWidget());
|
||||||
QList<int> sizes;
|
QList<int> sizes;
|
||||||
|
@ -674,15 +674,19 @@ void PropertiesWidget::renameSelectedFile()
|
||||||
const QModelIndexList selectedIndexes = m_ui->filesList->selectionModel()->selectedRows(0);
|
const QModelIndexList selectedIndexes = m_ui->filesList->selectionModel()->selectedRows(0);
|
||||||
if (selectedIndexes.size() != 1)
|
if (selectedIndexes.size() != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QModelIndex index = selectedIndexes.first();
|
const QModelIndex index = selectedIndexes.first();
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Ask for new name
|
// Ask for new name
|
||||||
bool ok;
|
bool ok = false;
|
||||||
QString new_name_last = AutoExpandableDialog::getText(this, tr("Rename the file"),
|
QString new_name_last = AutoExpandableDialog::getText(this, tr("Rename the file"),
|
||||||
tr("New name:"), QLineEdit::Normal,
|
tr("New name:"), QLineEdit::Normal,
|
||||||
index.data().toString(), &ok).trimmed();
|
index.data().toString(), &ok).trimmed();
|
||||||
if (ok && !new_name_last.isEmpty()) {
|
if (!ok || new_name_last.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!Utils::Fs::isValidFileSystemName(new_name_last)) {
|
if (!Utils::Fs::isValidFileSystemName(new_name_last)) {
|
||||||
MessageBoxRaised::warning(this, tr("The file could not be renamed"),
|
MessageBoxRaised::warning(this, tr("The file could not be renamed"),
|
||||||
tr("This file name contains forbidden characters, please choose a different one."),
|
tr("This file name contains forbidden characters, please choose a different one."),
|
||||||
|
@ -786,7 +790,6 @@ void PropertiesWidget::renameSelectedFile()
|
||||||
--timeout;
|
--timeout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertiesWidget::openSelectedFile()
|
void PropertiesWidget::openSelectedFile()
|
||||||
|
|
Loading…
Reference in a new issue