mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
Improve coding style
This commit is contained in:
@@ -58,23 +58,27 @@ QString TorrentCategoryDialog::createCategory(QWidget *parent, const QString &pa
|
||||
|
||||
TorrentCategoryDialog dialog(parent);
|
||||
dialog.setCategoryName(newCategoryName);
|
||||
while (dialog.exec() == TorrentCategoryDialog::Accepted) {
|
||||
while (dialog.exec() == TorrentCategoryDialog::Accepted)
|
||||
{
|
||||
newCategoryName = dialog.categoryName();
|
||||
|
||||
if (!BitTorrent::Session::isValidCategoryName(newCategoryName)) {
|
||||
if (!BitTorrent::Session::isValidCategoryName(newCategoryName))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
parent, tr("Invalid category name")
|
||||
, tr("Category name cannot contain '\\'.\n"
|
||||
"Category name cannot start/end with '/'.\n"
|
||||
"Category name cannot contain '//' sequence."));
|
||||
}
|
||||
else if (BitTorrent::Session::instance()->categories().contains(newCategoryName)) {
|
||||
else if (BitTorrent::Session::instance()->categories().contains(newCategoryName))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
parent, tr("Category creation error")
|
||||
, tr("Category with the given name already exists.\n"
|
||||
"Please choose a different name and try again."));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Session::instance()->addCategory(newCategoryName, dialog.savePath());
|
||||
return newCategoryName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user