Added an "Event" tab with a BiddingRoundControl class in it. No connections of signals and slots yet.
This commit is contained in:
@ -36,6 +36,7 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
views/itemdetailmapper.h views/itemdetailmapper.cpp
|
||||
widgets/comboboxdelegate.h widgets/comboboxdelegate.cpp
|
||||
widgets/spinboxdelegate.h widgets/spinboxdelegate.cpp
|
||||
widgets/biddingroundcontrol.h widgets/biddingroundcontrol.cpp
|
||||
)
|
||||
# Define target properties for Android with Qt 6 as:
|
||||
# set_property(TARGET ${TARGET_APP} APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include "model/generalsortfiltermodel.h"
|
||||
#include "model/metadata.h"
|
||||
#include "model/tablemodel.h"
|
||||
#include "widgets/biddingroundcontrol.h"
|
||||
#include "widgets/comboboxdelegate.h"
|
||||
#include "widgets/spinboxdelegate.h"
|
||||
|
||||
@ -70,6 +71,8 @@ MainWindow::MainWindow(QWidget* parent)
|
||||
|
||||
onSelectionChanged(QItemSelection(), QItemSelection());
|
||||
onCurrentChanged(QModelIndex(), QModelIndex());
|
||||
|
||||
setupEventTab();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() { delete ui; }
|
||||
@ -176,11 +179,6 @@ void MainWindow::on_actionCheck_for_update_triggered() {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_clicked() {
|
||||
const QString prefix("Backend provided by: ");
|
||||
ui->label->setText(prefix + m_core->toString());
|
||||
}
|
||||
|
||||
void MainWindow::openNewItemDialog() {
|
||||
showStatusMessage(tr("Invoked 'Edit|New Item'"));
|
||||
m_newItemDialog->show();
|
||||
@ -569,3 +567,13 @@ void MainWindow::createGuiDialogs() {
|
||||
m_editItemDialog = make_unique<EditItemDialog>(ui->tableView, this);
|
||||
m_editItemDialog->createContent();
|
||||
}
|
||||
|
||||
void MainWindow::setupEventTab() {
|
||||
QWidget* containerWidget = new QWidget();
|
||||
QVBoxLayout* containerLayout = new QVBoxLayout(containerWidget);
|
||||
m_biddingRoundControl = make_unique<BiddingRoundControl>();
|
||||
containerLayout->addWidget(m_biddingRoundControl.get());
|
||||
|
||||
|
||||
ui->tabWidget->insertTab(0, containerWidget, "Event (&1)");
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ class TableModel;
|
||||
class GeneralSortFilterModel;
|
||||
class NewItemDialog;
|
||||
class EditItemDialog;
|
||||
class BiddingRoundControl;
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -44,8 +45,6 @@ class MainWindow : public QMainWindow {
|
||||
void onAboutClicked();
|
||||
void on_actionCheck_for_update_triggered();
|
||||
|
||||
void on_pushButton_clicked();
|
||||
|
||||
/// slots for menu actions
|
||||
void openNewItemDialog();
|
||||
void openEditItemDialog();
|
||||
@ -78,7 +77,7 @@ class MainWindow : public QMainWindow {
|
||||
shared_ptr<GeneralSortFilterModel> m_proxyModel;
|
||||
QUndoStack* m_modelUndoStack;
|
||||
unique_ptr<QUndoView> m_modelUndoView;
|
||||
|
||||
unique_ptr<BiddingRoundControl> m_biddingRoundControl;
|
||||
/// File actions
|
||||
unique_ptr<QAction> m_newFileAct;
|
||||
unique_ptr<QAction> m_openAct;
|
||||
@ -119,5 +118,7 @@ class MainWindow : public QMainWindow {
|
||||
void createToolsActions();
|
||||
void createHelpMenu();
|
||||
void createGuiDialogs();
|
||||
|
||||
void setupEventTab();
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
@ -14,22 +14,22 @@
|
||||
<string>GenericQtClient</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Push the button!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Button</string>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_user">
|
||||
<attribute name="title">
|
||||
<string>Mitglieder (&2)</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableView" name="tableView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
57
UIs/BeetRoundWidgets/widgets/biddingroundcontrol.cpp
Normal file
57
UIs/BeetRoundWidgets/widgets/biddingroundcontrol.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
#include "biddingroundcontrol.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
BiddingRoundControl::BiddingRoundControl(QWidget* parent)
|
||||
: QWidget{parent} {
|
||||
m_layout = new QHBoxLayout(this);
|
||||
m_title = new QLabel("Bidding round control:");
|
||||
m_status = new QLabel("(No round started yet.)");
|
||||
|
||||
m_newRoundButton = new QPushButton("Start new round");
|
||||
m_restartRoundButton = new QPushButton("Restart last round");
|
||||
m_stopRoundButton = new QPushButton("Stop round");
|
||||
m_refreshRoundButton = new QPushButton("Refresh");
|
||||
|
||||
m_newRoundButton->setEnabled(false);
|
||||
m_restartRoundButton->setEnabled(false);
|
||||
m_stopRoundButton->setEnabled(false);
|
||||
|
||||
m_layout->addWidget(m_title);
|
||||
m_layout->addWidget(m_status);
|
||||
m_layout->addWidget(m_newRoundButton);
|
||||
m_layout->addWidget(m_restartRoundButton);
|
||||
m_layout->addWidget(m_stopRoundButton);
|
||||
m_layout->addWidget(m_refreshRoundButton);
|
||||
|
||||
connect(m_newRoundButton, &QPushButton::clicked, this,
|
||||
&BiddingRoundControl::triggerStartNewRound);
|
||||
connect(m_restartRoundButton, &QPushButton::clicked, this,
|
||||
&BiddingRoundControl::triggerRestartLastRound);
|
||||
connect(m_stopRoundButton, &QPushButton::clicked, this,
|
||||
&BiddingRoundControl::triggerStopCurrentRound);
|
||||
connect(m_refreshRoundButton, &QPushButton::clicked, this,
|
||||
&BiddingRoundControl::onRefreshCurrentRoundTriggered);
|
||||
}
|
||||
|
||||
void BiddingRoundControl::onRefreshCurrentRoundTriggered() {
|
||||
emit sendGetRequest(GetCurrentBiddingRound);
|
||||
}
|
||||
|
||||
void BiddingRoundControl::onCurrentBiddingRoundChanged(int roundNumber, bool isActive) {
|
||||
QString text = QString::number(roundNumber);
|
||||
if (isActive) {
|
||||
text.append(" (active)");
|
||||
m_newRoundButton->setEnabled(false);
|
||||
m_restartRoundButton->setEnabled(false);
|
||||
m_stopRoundButton->setEnabled(true);
|
||||
} else {
|
||||
text.append(" (stopped)");
|
||||
m_newRoundButton->setEnabled(true);
|
||||
m_restartRoundButton->setEnabled(roundNumber > 0);
|
||||
m_stopRoundButton->setEnabled(false);
|
||||
}
|
||||
m_status->setText(text);
|
||||
}
|
||||
41
UIs/BeetRoundWidgets/widgets/biddingroundcontrol.h
Normal file
41
UIs/BeetRoundWidgets/widgets/biddingroundcontrol.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef BIDDINGROUNDCONTROL_H
|
||||
#define BIDDINGROUNDCONTROL_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "model/metadata.h"
|
||||
|
||||
class QPushButton;
|
||||
class QLabel;
|
||||
class QHBoxLayout;
|
||||
class BiddingRoundControl : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BiddingRoundControl(QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void sendGetRequest(GetRequestTypes type);
|
||||
|
||||
void triggerStartNewRound();
|
||||
void triggerRestartLastRound();
|
||||
void triggerStopCurrentRound();
|
||||
// void refreshCurrentRound();
|
||||
|
||||
public slots:
|
||||
/// button slots
|
||||
void onRefreshCurrentRoundTriggered();
|
||||
|
||||
/// event slots
|
||||
void onCurrentBiddingRoundChanged(int roundNumber, bool isActive);
|
||||
|
||||
private:
|
||||
QHBoxLayout* m_layout = nullptr;
|
||||
QLabel* m_title = nullptr;
|
||||
QLabel* m_status = nullptr;
|
||||
|
||||
QPushButton* m_newRoundButton = nullptr;
|
||||
QPushButton* m_restartRoundButton = nullptr;
|
||||
QPushButton* m_stopRoundButton = nullptr;
|
||||
QPushButton* m_refreshRoundButton = nullptr;
|
||||
};
|
||||
|
||||
#endif // BIDDINGROUNDCONTROL_H
|
||||
@ -82,6 +82,9 @@ static const QString ITEM_KEY_STRING = "item";
|
||||
/// file naming
|
||||
static const QString ITEMS_FILE_NAME = ITEMS_KEY_STRING + ".json";
|
||||
|
||||
/// server communication
|
||||
enum GetRequestTypes { GetCurrentBiddingRound };
|
||||
|
||||
/// functions
|
||||
static UserRoles GET_ROLE_FOR_COLUMN(const int column) {
|
||||
switch (column) {
|
||||
|
||||
Reference in New Issue
Block a user