Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Simplified the logic to be in a single line.

  • Loading branch information...
commit a5782495d6f5e700463e608fe332b6bd9e8c0dcc 1 parent a1d0cd2
Jacky Alciné authored March 15, 2012
19  src/app/windows/content-information-dialog.cpp
@@ -32,7 +32,7 @@ ContentInformationDialog::ContentInformationDialog (Content* p_content) :
32 32
     m_content (p_content)
33 33
 {
34 34
     m_ui->setupUi (this);
35  
-    this->setLayout(m_ui->verticalLayout);
  35
+    this->setLayout (m_ui->verticalLayout);
36 36
     updateUi();
37 37
 
38 38
     connect (m_ui->btnGoLeft, SIGNAL (clicked()), this, SLOT (goToPreviousPage()));
@@ -67,18 +67,11 @@ void ContentInformationDialog::goToPage (const int p_index)
67 67
     m_ui->txtEdit->setPlainText (m_content->pageAt (p_index));
68 68
     m_ui->lblPageCounter->setText (tr ("Page %1 of %2").arg (p_index + 1).arg (m_content->pageCount()));
69 69
 
70  
-    if (m_indx == 0) {
71  
-        m_ui->btnGoLeft->setEnabled (false);
72  
-        m_ui->btnGoRight->setEnabled (true);
73  
-    }
74  
-    else if (m_indx == m_content->pageCount() - 1) {
75  
-        m_ui->btnGoLeft->setEnabled (true);
76  
-        m_ui->btnGoRight->setEnabled (false);
77  
-    }
78  
-    else {
79  
-        m_ui->btnGoLeft->setEnabled (true);
80  
-        m_ui->btnGoRight->setEnabled (true);
81  
-    }
  70
+    const bool isAtLast = m_indx == m_content->pageCount() - 1;
  71
+    const bool isAtFirst  = m_indx == 0;
  72
+
  73
+    m_ui->btnGoLeft->setEnabled (!isAtFirst);
  74
+    m_ui->btnGoRight->setEnabled (!isAtLast);
82 75
 }
83 76
 
84 77
 ContentInformationDialog::~ContentInformationDialog()

0 notes on commit a578249

Please sign in to comment.
Something went wrong with that request. Please try again.