Switch autos to east const

This commit is contained in:
Gary Talent 2023-07-21 01:19:07 -05:00
parent 814cef4a2e
commit bc342a290f
7 changed files with 35 additions and 35 deletions

View File

@ -26,7 +26,7 @@ void CameraClient::setPreset(int preset) {
}
void CameraClient::setBaseUrl() {
const auto [host, port] = getCameraConnectionData();
auto const [host, port] = getCameraConnectionData();
m_baseUrl = QString("http://%1:%2").arg(host, QString::number(port));
}

View File

@ -22,19 +22,19 @@ MainWindow::MainWindow(QWidget *parent): QMainWindow(parent) {
setFixedSize(610, 555);
setWindowTitle(tr("Slide Controller 9000"));
setupMenu();
const auto mainWidget = new QWidget(this);
auto const mainWidget = new QWidget(this);
m_rootLyt = new QVBoxLayout;
const auto controlsLayout = new QGridLayout;
auto const controlsLayout = new QGridLayout;
m_slideView = new SlideView(this);
setCentralWidget(mainWidget);
mainWidget->setLayout(m_rootLyt);
m_rootLyt->addWidget(m_slideView);
m_rootLyt->addLayout(controlsLayout);
// setup slide controls
const auto btnPrevSong = new QPushButton(tr("Previous Song"), this);
const auto btnPrevSlide = new QPushButton(tr("Previous Slide"), this);
const auto btnNextSlide = new QPushButton(tr("Next Slide"), this);
const auto btnNextSong = new QPushButton(tr("Next Song"), this);
auto const btnPrevSong = new QPushButton(tr("Previous Song"), this);
auto const btnPrevSlide = new QPushButton(tr("Previous Slide"), this);
auto const btnNextSlide = new QPushButton(tr("Next Slide"), this);
auto const btnNextSong = new QPushButton(tr("Next Song"), this);
btnPrevSong->setToolTip(tr("Change to previous song (left arrow key)"));
btnPrevSlide->setToolTip(tr("Change to previous slide (up arrow key)"));
btnNextSong->setToolTip(tr("Change to next song (right arrow key)"));

View File

@ -42,7 +42,7 @@ void OBSClient::setSlidesVisible(bool state) {
}
void OBSClient::setBaseUrl() {
const auto [host, port] = getOBSConnectionData();
auto const [host, port] = getOBSConnectionData();
m_baseUrl = QString("http://%1:%2").arg(host, QString::number(port));
}

View File

@ -28,8 +28,8 @@ OpenLPClient::OpenLPClient(QObject *parent): QObject(parent) {
}
QString OpenLPClient::getNextSong() {
const auto currentSong = m_songNameMap[m_currentSongId];
const auto songIdx = m_songList.indexOf(currentSong) + 1;
auto const currentSong = m_songNameMap[m_currentSongId];
auto const songIdx = m_songList.indexOf(currentSong) + 1;
if (songIdx < m_songList.size()) {
return m_songList[songIdx];
}
@ -81,7 +81,7 @@ void OpenLPClient::changeSlide(int slide) {
}
void OpenLPClient::setBaseUrl() {
const auto [host, port] = getOpenLPConnectionData();
auto const [host, port] = getOpenLPConnectionData();
m_baseUrl = QString("http://%1:%2").arg(host, QString::number(port));
}
@ -160,7 +160,7 @@ void OpenLPClient::handleSongListResponse(QNetworkReply *reply) {
auto items = doc.object()["results"].toObject()["items"].toArray();
m_songNameMap.clear();
m_songList.clear();
for (const auto &item : items) {
for (auto const &item : items) {
auto song = item.toObject();
auto name = song["title"].toString();
auto id = song["id"].toString();
@ -183,7 +183,7 @@ void OpenLPClient::handleSlideListResponse(QNetworkReply *reply) {
QStringList tagList;
auto doc = QJsonDocument::fromJson(data);
auto items = doc.object()["results"].toObject()["slides"].toArray();
for (const auto &item : items) {
for (auto const &item : items) {
auto slide = item.toObject();
auto text = slide["text"].toString();
auto tag = slide["tag"].toString();

View File

@ -121,7 +121,7 @@ void setViews(QVector<View> const&views) {
QVector<View> getViews(QSettings &settings) {
QVector<View> out;
settings.beginGroup("Views");
const auto size = settings.beginReadArray("Views");
auto const size = settings.beginReadArray("Views");
for (auto i = 0; i < size; ++i) {
settings.setArrayIndex(i);
out.emplace_back(View{

View File

@ -31,8 +31,8 @@ enum ViewColumn {
};
SettingsDialog::SettingsDialog(QWidget *parent): QDialog(parent) {
const auto lyt = new QVBoxLayout(this);
const auto tabs = new QTabWidget(this);
auto const lyt = new QVBoxLayout(this);
auto const tabs = new QTabWidget(this);
lyt->addWidget(tabs);
tabs->addTab(setupViewConfig(tabs), tr("&Views"));
tabs->addTab(setupNetworkInputs(tabs), tr("&Network"));
@ -41,13 +41,13 @@ SettingsDialog::SettingsDialog(QWidget *parent): QDialog(parent) {
}
QWidget *SettingsDialog::setupNetworkInputs(QWidget *parent) {
const auto root = new QWidget(parent);
const auto lyt = new QFormLayout(root);
const auto portValidator = new QIntValidator(1, 65536, this);
auto const root = new QWidget(parent);
auto const lyt = new QFormLayout(root);
auto const portValidator = new QIntValidator(1, 65536, this);
QSettings settings;
// camera settings
{
const auto c = getCameraConnectionData(settings);
auto const c = getCameraConnectionData(settings);
m_cameraHostLe = new QLineEdit(root);
m_cameraPortLe = new QLineEdit(root);
m_cameraHostLe->setText(c.host);
@ -58,7 +58,7 @@ QWidget *SettingsDialog::setupNetworkInputs(QWidget *parent) {
}
// OpenLP settings
{
const auto c = getOpenLPConnectionData(settings);
auto const c = getOpenLPConnectionData(settings);
m_openLpHostLe = new QLineEdit(root);
m_openLpPortLe = new QLineEdit(root);
m_openLpHostLe->setText(c.host);
@ -69,7 +69,7 @@ QWidget *SettingsDialog::setupNetworkInputs(QWidget *parent) {
}
// OBS settings
{
const auto c = getOBSConnectionData(settings);
auto const c = getOBSConnectionData(settings);
m_obsHostLe = new QLineEdit(root);
m_obsPortLe = new QLineEdit(root);
m_obsHostLe->setText(c.host);
@ -132,7 +132,7 @@ QWidget *SettingsDialog::setupViewConfig(QWidget *parent) {
rmBtn->setEnabled(row > -1 && row < m_viewTable->rowCount());
addBtn->setEnabled(m_viewTable->rowCount() < MaxViews);
});
const auto views = getViews();
auto const views = getViews();
m_viewTable->setRowCount(static_cast<int>(views.size()));
for (auto row = 0; auto const&view : views) {
setupViewRow(row, view);
@ -143,11 +143,11 @@ QWidget *SettingsDialog::setupViewConfig(QWidget *parent) {
}
QWidget *SettingsDialog::setupButtons(QWidget *parent) {
const auto root = new QWidget(parent);
const auto lyt = new QHBoxLayout(root);
auto const root = new QWidget(parent);
auto const lyt = new QHBoxLayout(root);
m_errLbl = new QLabel(root);
const auto okBtn = new QPushButton(tr("&OK"), root);
const auto cancelBtn = new QPushButton(tr("&Cancel"), root);
auto const okBtn = new QPushButton(tr("&OK"), root);
auto const cancelBtn = new QPushButton(tr("&Cancel"), root);
lyt->addWidget(m_errLbl);
lyt->addSpacerItem(new QSpacerItem(1000, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
lyt->addWidget(okBtn);
@ -182,18 +182,18 @@ void SettingsDialog::handleOK() {
void SettingsDialog::setupViewRow(int row, View const&view) {
// name
const auto nameItem = new QTableWidgetItem(view.name);
auto const nameItem = new QTableWidgetItem(view.name);
m_viewTable->setItem(row, ViewColumn::Name, nameItem);
// slides
const auto slidesCb = new QCheckBox(m_viewTable);
auto const slidesCb = new QCheckBox(m_viewTable);
slidesCb->setChecked(view.slides);
m_viewTable->setCellWidget(row, ViewColumn::Slides, slidesCb);
// obs slides
const auto obsSlidesCb = new QCheckBox(m_viewTable);
auto const obsSlidesCb = new QCheckBox(m_viewTable);
obsSlidesCb->setChecked(view.obsSlides);
m_viewTable->setCellWidget(row, ViewColumn::ObsSlides, obsSlidesCb);
// camera preset
const auto presetItem = new QTableWidgetItem(QString::number(view.cameraPreset));
auto const presetItem = new QTableWidgetItem(QString::number(view.cameraPreset));
m_viewTable->setItem(row, ViewColumn::CameraPreset, presetItem);
}
@ -206,7 +206,7 @@ int SettingsDialog::collectViews(QVector<View> &views) const {
m_errLbl->setText(tr("View %1 has no name.").arg(viewNo));
return 1;
}
const auto cameraPreset = m_viewTable->item(row, ViewColumn::CameraPreset)->text().toInt(&ok);
auto const cameraPreset = m_viewTable->item(row, ViewColumn::CameraPreset)->text().toInt(&ok);
if (!ok || cameraPreset < 1 || cameraPreset > MaxCameraPresets) {
m_errLbl->setText(tr("View %1 has invalid preset (1-%2)").arg(viewNo).arg(MaxCameraPresets));
return 2;

View File

@ -34,8 +34,8 @@ SlideView::SlideView(QWidget *parent): QWidget(parent) {
}
QString SlideView::getNextSong() const {
const auto cnt = m_songSelector->count();
const auto idx = m_songSelector->currentRow() + 1;
auto const cnt = m_songSelector->count();
auto const idx = m_songSelector->currentRow() + 1;
if (idx < cnt) {
return m_songSelector->currentItem()->text();
}
@ -72,7 +72,7 @@ void SlideView::slideListUpdate(QStringList const&tagList, QStringList const&sli
m_currentSlide = 0;
m_slideTable->setRowCount(static_cast<int>(slideList.size()));
for (int i = 0; i < slideList.size(); ++i) {
const auto& txt = slideList[i];
auto const& txt = slideList[i];
auto item = new QTableWidgetItem(txt);
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
m_slideTable->setItem(i, 0, item);