Code formatting/indentation unified in trunk
[qtrapids] / src / gui / PreferencesDialog.cpp
index 9ee381b..3742c41 100644 (file)
 
 #include "PreferencesDialog.h"
 
-PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags f) : 
-       QDialog(parent, f), // Superclass
-       dirLineEdit_(NULL),
-       dialogButtons_(NULL),
-       settings_()
+PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags f) :
+        QDialog(parent, f), // Superclass
+        dirLineEdit_(NULL),
+        dialogButtons_(NULL),
+        settings_()
 {
-       setWindowTitle("Preferences");
-       
-       QBoxLayout *verticalBox = new QBoxLayout(QBoxLayout::TopToBottom);
-       QBoxLayout *horizontalBox1 = new QBoxLayout(QBoxLayout::LeftToRight);
-       setLayout(verticalBox); 
-       verticalBox->addLayout(horizontalBox1);
-
-       QLabel *dirLabel = new QLabel(tr("Download directory: "));
-       dirLineEdit_ = new QLineEdit(this);
-       QPushButton *browseDirButton = new QPushButton(tr("Browse.."));
-       
-       horizontalBox1->addWidget(dirLabel);
-       horizontalBox1->addWidget(dirLineEdit_);
-       horizontalBox1->addWidget(browseDirButton);
-       
-       connect(browseDirButton, SIGNAL(clicked()),
-                                       this, SLOT(on_browseDirButtonClicked()));
-       
-       
-       dialogButtons_ = new QDialogButtonBox(this);
-       dialogButtons_->setStandardButtons(QDialogButtonBox::Ok
-                                                                                                                                                       | QDialogButtonBox::Apply 
-                                                                                                                                                       | QDialogButtonBox::Cancel);
-       
-       verticalBox->addWidget(dialogButtons_);
-       
-       connect(dialogButtons_, SIGNAL(clicked(QAbstractButton*)),
-                                       this, SLOT(on_buttonClicked(QAbstractButton*)));
-       
-       // Set saved preference values to fields.
-       ReadSettings();
-       
+    setWindowTitle("Preferences");
+
+    QBoxLayout *verticalBox = new QBoxLayout(QBoxLayout::TopToBottom);
+    QBoxLayout *horizontalBox1 = new QBoxLayout(QBoxLayout::LeftToRight);
+    setLayout(verticalBox);
+    verticalBox->addLayout(horizontalBox1);
+
+    QLabel *dirLabel = new QLabel(tr("Download directory: "));
+    dirLineEdit_ = new QLineEdit(this);
+    QPushButton *browseDirButton = new QPushButton(tr("Browse.."));
+
+    horizontalBox1->addWidget(dirLabel);
+    horizontalBox1->addWidget(dirLineEdit_);
+    horizontalBox1->addWidget(browseDirButton);
+
+    connect(browseDirButton, SIGNAL(clicked()),
+            this, SLOT(on_browseDirButtonClicked()));
+
+
+    dialogButtons_ = new QDialogButtonBox(this);
+    dialogButtons_->setStandardButtons(QDialogButtonBox::Ok
+                                       | QDialogButtonBox::Apply
+                                       | QDialogButtonBox::Cancel);
+
+    verticalBox->addWidget(dialogButtons_);
+
+    connect(dialogButtons_, SIGNAL(clicked(QAbstractButton*)),
+            this, SLOT(on_buttonClicked(QAbstractButton*)));
+
+    // Set saved preference values to fields.
+    ReadSettings();
+
 }
 
 
@@ -76,68 +76,68 @@ PreferencesDialog::~PreferencesDialog()
 // ======================== SLOTS ========================
 void PreferencesDialog::on_browseDirButtonClicked()
 {
-       QFileDialog *dialog 
-                       = new QFileDialog(this, "Download directory",   
-                                                                                               QString(), tr("Torrent files (*.torrent)"));
-       
-       dialog->setFileMode(QFileDialog::Directory);
-       dialog->setOption(QFileDialog::ShowDirsOnly, true);
-       
-       connect(dialog, SIGNAL(fileSelected(const QString&)),
-                                       this, SLOT(on_downloadDirectorySelected(const QString&)));
-       
-       dialog->show();
+    QFileDialog *dialog
+    = new QFileDialog(this, "Download directory",
+                      QString(), tr("Torrent files (*.torrent)"));
+
+    dialog->setFileMode(QFileDialog::Directory);
+    dialog->setOption(QFileDialog::ShowDirsOnly, true);
+
+    connect(dialog, SIGNAL(fileSelected(const QString&)),
+            this, SLOT(on_downloadDirectorySelected(const QString&)));
+
+    dialog->show();
 }
 
 void PreferencesDialog::on_buttonClicked(QAbstractButton* button)
 {
-       switch (dialogButtons_->buttonRole ( button ) )
-       {
-               case QDialogButtonBox::AcceptRole :
-                       qDebug() << "PreferencesDialog: OK";
-                       WriteSettings();
-                       close();
-                       break;
-               case QDialogButtonBox::ApplyRole :
-                       qDebug() << "PreferencesDialog: APPLY";
-                       WriteSettings();
-                       break;
-               case QDialogButtonBox::RejectRole : 
-                       qDebug() << "PreferencesDialog: CANCEL";
-                       close();
-                       break;
-               default: 
-                       return;
-       }
+    switch (dialogButtons_->buttonRole ( button ) )
+    {
+    case QDialogButtonBox::AcceptRole :
+        qDebug() << "PreferencesDialog: OK";
+        WriteSettings();
+        close();
+        break;
+    case QDialogButtonBox::ApplyRole :
+        qDebug() << "PreferencesDialog: APPLY";
+        WriteSettings();
+        break;
+    case QDialogButtonBox::RejectRole :
+        qDebug() << "PreferencesDialog: CANCEL";
+        close();
+        break;
+    default:
+        return;
+    }
 }
 
 void PreferencesDialog::on_downloadDirectorySelected(const QString& directory)
 {
-       qDebug() << "PreferencesDialog::on_downloadDirectorySelected(): " << directory;
-       // Torrent filename empty, do nothing.
-       if (directory == "") 
-               return;
-       
-       dirLineEdit_->insert(directory);
-       
-       /// @todo check that user has privileges to write to this directory.
+    qDebug() << "PreferencesDialog::on_downloadDirectorySelected(): " << directory;
+    // Torrent filename empty, do nothing.
+    if (directory == "")
+        return;
+
+    dirLineEdit_->insert(directory);
+
+    /// @todo check that user has privileges to write to this directory.
 }
 
 
 // ========================= Private functions ==========================
 void PreferencesDialog::WriteSettings()
 {
-       settings_.setValue("download/directory", dirLineEdit_->text());
-       
-       // NOTE: We might need to call QSettigns::sync() here to instantly write settings.
-       // settings are written also by QSettings() destructor and by event loop at regular interval.
+    settings_.setValue("download/directory", dirLineEdit_->text());
+
+    // NOTE: We might need to call QSettigns::sync() here to instantly write settings.
+    // settings are written also by QSettings() destructor and by event loop at regular interval.
 }
 
 void PreferencesDialog::ReadSettings()
 {
-       dirLineEdit_->insert(settings_.value("download/directory").toString());
-       
-       // NOTE: We might need to call QSettigns::sync() here to instantly write settings.
-       // settings are written also by QSettings() destructor and by event loop at regular interval.
+    dirLineEdit_->insert(settings_.value("download/directory").toString());
+
+    // NOTE: We might need to call QSettigns::sync() here to instantly write settings.
+    // settings are written also by QSettings() destructor and by event loop at regular interval.
 }