Skip to content

Commit

Permalink
Renames methods from QLineSpinPopup to make them more generalizable a…
Browse files Browse the repository at this point in the history
…nd more in-line with default Qt style.
  • Loading branch information
leoyala committed Jan 14, 2025
1 parent 910766b commit efe816a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
11 changes: 3 additions & 8 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,10 @@ MainWindow::~MainWindow()

void MainWindow::RecordSnapshots()
{
const int nrImages = m_snapshotPopup->GetNumberOfSnapshots();
const int nrImages = m_snapshotPopup->value();
ToggleSnapshotUI(false);

std::string fileName = m_snapshotPopup->GetFileNameSnapshot().toUtf8().constData();

if (fileName.empty())
{
fileName = m_fileName.toUtf8().constData();
}
std::string fileName = m_snapshotPopup->text().toUtf8().constData();
const QString filePath = GetFullFilenameStandardFormat(std::move(fileName), ".b2nd", "");
const auto snapshotsFile = OpenFileForSnapshots(filePath);
if (!snapshotsFile)
Expand Down Expand Up @@ -386,7 +381,7 @@ void MainWindow::ShowErrorDialog(const QString &text, const QString &informative

void MainWindow::HandleSnapshotButtonClicked()
{
const auto invalidFileName = HandleFileNameSnapshotsLineEditTextEdited(m_snapshotPopup->GetFileNameSnapshot());
const auto invalidFileName = HandleFileNameSnapshotsLineEditTextEdited(m_snapshotPopup->text());
if (invalidFileName)
{
return;
Expand Down
14 changes: 7 additions & 7 deletions src/widgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class QLineSpinPopup : public QWidget
{
public:
/**
* @brief Constructs a popup widget containing a QLineEdit ("fileNameSnapshot") and a QSpinBox ("nSnapshots").
* @brief Constructs a popup widget containing a QLineEdit and a QSpinBox.
*
* The line edit and spin box are embedded within a horizontal-oriented layout to ensure proper placement.
* The widget is styled as a frameless popup window.
Expand All @@ -353,7 +353,7 @@ class QLineSpinPopup : public QWidget
*
* @return The text entered into the QLineEdit.
*/
QString GetFileNameSnapshot() const
QString text() const
{
return m_lineEdit->text();
}
Expand All @@ -363,7 +363,7 @@ class QLineSpinPopup : public QWidget
*
* @param fileName The file name to set in the QLineEdit.
*/
void SetFileNameSnapshot(const QString &fileName) const
void setText(const QString &fileName) const
{
m_lineEdit->setText(fileName);
}
Expand All @@ -373,7 +373,7 @@ class QLineSpinPopup : public QWidget
*
* @return The current value of the QSpinBox.
*/
int GetNumberOfSnapshots() const
int value() const
{
return m_spinBox->value();
}
Expand All @@ -383,18 +383,18 @@ class QLineSpinPopup : public QWidget
*
* @param value The value to set in the QSpinBox.
*/
void SetNumberOfSnapshots(const int value) const
void setValue(const int value) const
{
m_spinBox->setValue(value);
}

/**
* Line edit for entering the snapshot file name.
* Line edit for entering user specified text.
*/
QLineEdit *m_lineEdit;

/**
* Spin box for setting the number of snapshots.
* Spin box for setting user-defined integer values.
*/
QSpinBox *m_spinBox;

Expand Down

0 comments on commit efe816a

Please sign in to comment.