Fixed some inconsistencies in code indentation
[jenirok] / src / gui / mainwindow.cpp
index d340fa1..cec7517 100644 (file)
 
 namespace
 {
 
 namespace
 {
-       const QString START_ICON = ":/icons/start.png";
-       const QString CLOSE_ICON = ":/icons/stop.png";
+    const QString START_ICON = ":/icons/start.png";
+    const QString CLOSE_ICON = ":/icons/stop.png";
 }
 
 MainWindow::MainWindow(QWidget* parent): QMainWindow(parent),
 searchResults_(0), settingsDialog_(0), running_(false),
 toggleButton_(0), searchDialog_(0)
 {
 }
 
 MainWindow::MainWindow(QWidget* parent): QMainWindow(parent),
 searchResults_(0), settingsDialog_(0), running_(false),
 toggleButton_(0), searchDialog_(0)
 {
-       setWindowTitle(tr("Jenirok"));
-       setAttribute(Qt::WA_Maemo5StackedWindow);
-       QWidget* mainWidget = new QWidget(this);
-
-       if(Daemon::isRunning())
-       {
-               toggleButton_ = createButton(tr("Stop daemon"));
-               toggleButton_->setIcon(QIcon(CLOSE_ICON));
-               running_ = true;
-       }
-       else
-       {
-               toggleButton_ = createButton(tr("Start daemon"));
-               toggleButton_->setIcon(QIcon(START_ICON));
-               running_ = false;
-       }
-
-       QToolButton* searchButton = createButton(tr("Search"));
-       searchButton->setIcon(QIcon::fromTheme("general_search"));
-
-       QSize size(64, 64);
-       searchButton->setIconSize(size);
-       toggleButton_->setIconSize(size);
-
-       QHBoxLayout *buttonLayout = new QHBoxLayout;
-       buttonLayout->addWidget(toggleButton_, Qt::AlignLeft);
-       buttonLayout->addWidget(searchButton, Qt::AlignRight);
-
-       mainWidget->setLayout(buttonLayout);
-
-       connect(toggleButton_, SIGNAL(pressed()), this, SLOT(toggleDaemon()));
-       connect(searchButton, SIGNAL(pressed()), this, SLOT(openSearch()));
-
-       setCentralWidget(mainWidget);
-       menuBar()->addAction(tr("Settings"), this, SLOT(showSettings()));
+    setWindowTitle(tr("Jenirok"));
+    setAttribute(Qt::WA_Maemo5StackedWindow);
+    QWidget* mainWidget = new QWidget(this);
+
+    if(Daemon::isRunning())
+    {
+        toggleButton_ = createButton(tr("Stop daemon"));
+        toggleButton_->setIcon(QIcon(CLOSE_ICON));
+        running_ = true;
+    }
+    else
+    {
+        toggleButton_ = createButton(tr("Start daemon"));
+        toggleButton_->setIcon(QIcon(START_ICON));
+        running_ = false;
+    }
+
+    QToolButton* searchButton = createButton(tr("Search"));
+    searchButton->setIcon(QIcon::fromTheme("general_search"));
+
+    QSize size(64, 64);
+    searchButton->setIconSize(size);
+    toggleButton_->setIconSize(size);
+
+    QHBoxLayout *buttonLayout = new QHBoxLayout;
+    buttonLayout->addWidget(toggleButton_, Qt::AlignLeft);
+    buttonLayout->addWidget(searchButton, Qt::AlignRight);
+
+    mainWidget->setLayout(buttonLayout);
+
+    connect(toggleButton_, SIGNAL(pressed()), this, SLOT(toggleDaemon()));
+    connect(searchButton, SIGNAL(pressed()), this, SLOT(openSearch()));
+
+    setCentralWidget(mainWidget);
+    menuBar()->addAction(tr("Settings"), this, SLOT(showSettings()));
 }
 
 MainWindow::~MainWindow()
 {
 }
 
 MainWindow::~MainWindow()
 {
-       DB::removeDatabase();
+    DB::removeDatabase();
 }
 
 void MainWindow::showSettings()
 {
 }
 
 void MainWindow::showSettings()
 {
-       if(!settingsDialog_)
-       {
-               settingsDialog_ = new SettingsDialog(this);
-       }
+    if(!settingsDialog_)
+    {
+        settingsDialog_ = new SettingsDialog(this);
+    }
 
 
-       settingsDialog_->show();
+    settingsDialog_->show();
 }
 
 void MainWindow::toggleDaemon()
 }
 
 void MainWindow::toggleDaemon()
@@ -102,66 +102,66 @@ void MainWindow::toggleDaemon()
 
     if(running_)
     {
 
     if(running_)
     {
-               readyText = tr("Daemon was successfully stopped.");
-               failText = tr("Unable to stop daemon.");
-               buttonText = tr("Start daemon");
-               ret = Daemon::stop();
+        readyText = tr("Daemon was successfully stopped.");
+        failText = tr("Unable to stop daemon.");
+        buttonText = tr("Start daemon");
+        ret = Daemon::stop();
     }
     else
     {
     }
     else
     {
-       readyText = tr("Daemon was successfully started.");
-       failText = tr("Unable to start daemon.");
-       buttonText = tr("Stop daemon");
-       ret = Daemon::start();
+        readyText = tr("Daemon was successfully started.");
+        failText = tr("Unable to start daemon.");
+        buttonText = tr("Stop daemon");
+        ret = Daemon::start();
     }
 
     if(!ret)
     {
     }
 
     if(!ret)
     {
-       QMessageBox::critical(this, tr("Error"), failText);
+        QMessageBox::critical(this, tr("Error"), failText);
     }
     else
     {
     }
     else
     {
-       QMaemo5InformationBox::information(this, readyText);
-       toggleButton_->setText(buttonText);
-       toggleButton_->setIcon(QIcon(running_ ? START_ICON : CLOSE_ICON));
-       running_ = !running_;
+        QMaemo5InformationBox::information(this, readyText);
+        toggleButton_->setText(buttonText);
+        toggleButton_->setIcon(QIcon(running_ ? START_ICON : CLOSE_ICON));
+        running_ = !running_;
     }
 
 }
 
 void MainWindow::openSearch()
 {
     }
 
 }
 
 void MainWindow::openSearch()
 {
-       DB::connect();
+    DB::connect();
 
 
-       QString username = Settings::instance()->get("eniro_username");
-       QString password = Settings::instance()->get("eniro_password");
+    QString username = Settings::instance()->get("eniro_username");
+    QString password = Settings::instance()->get("eniro_password");
 
 
-       DB::disconnect();
+    DB::disconnect();
 
 
-       if(username.isEmpty() || password.isEmpty())
-       {
-               QMessageBox::information(this, tr("Info"), tr("You need to set Eniro login details in settings before using this feature."));
-               return;
-       }
+    if(username.isEmpty() || password.isEmpty())
+    {
+        QMessageBox::information(this, tr("Info"), tr("You need to set Eniro login details in settings before using this feature."));
+        return;
+    }
 
 
-       if(!searchDialog_)
-       {
-               searchDialog_ = new SearchDialog(this);
-               connect(searchDialog_, SIGNAL(search(SearchDialog::SearchDetails&)), this, SLOT(handleSearch(SearchDialog::SearchDetails&)));
-       }
+    if(!searchDialog_)
+    {
+        searchDialog_ = new SearchDialog(this);
+        connect(searchDialog_, SIGNAL(search(SearchDialog::SearchDetails&)), this, SLOT(handleSearch(SearchDialog::SearchDetails&)));
+    }
 
 
-       searchDialog_->show();
+    searchDialog_->show();
 }
 
 QToolButton* MainWindow::createButton(QString const& text)
 {
 }
 
 QToolButton* MainWindow::createButton(QString const& text)
 {
-       QToolButton* button = new QToolButton();
-       button->setText(text);
-       button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
-       return button;
+    QToolButton* button = new QToolButton();
+    button->setText(text);
+    button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+    return button;
 }
 
 void MainWindow::handleSearch(SearchDialog::SearchDetails& details)
 {
 }
 
 void MainWindow::handleSearch(SearchDialog::SearchDetails& details)
 {
-       emit search(details);
+    emit search(details);
 }
 }