Skip to content

Commit d49935a

Browse files
committed
Merge remote-tracking branch 'upstream' into MaxLair/AddedSaveOnTheGo
2 parents 8f2e4fd + 0215521 commit d49935a

19 files changed

Lines changed: 68 additions & 33 deletions

File tree

.github/workflows/cpp-ci-serial-programs-base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
echo https://github.com/${{github.repository}}/commit/${{github.sha}} > ${{env.UPLOAD_FOLDER}}/version.txt
9696
9797
- name: Upload Build
98-
uses: actions/upload-artifact@v6
98+
uses: actions/upload-artifact@v7
9999
if: inputs.upload-build
100100
with:
101101
name: Serial Programs (os=${{inputs.os}} - compiler=${{inputs.compiler}})

Common/Qt/NoWheelComboBox.h

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* ComboBox without mouse wheel scrolling.
1+
/* ComboBox without mouse wheel scrolling. Also, the height has been set to be more compact.
22
*
33
* From: https://github.com/PokemonAutomation/
44
*
@@ -8,15 +8,39 @@
88
#define PokemonAutomation_NoWheelComboBox_H
99

1010
#include <QComboBox>
11+
#include <QAbstractItemView>
12+
#include <QStyledItemDelegate>
1113

1214
//#define PA_ENABLE_SIZE_CACHING
1315

1416
namespace PokemonAutomation{
1517

1618

17-
class NoWheelComboBox : public QComboBox{
19+
class HeightDelegate : public QStyledItemDelegate {
1820
public:
19-
using QComboBox::QComboBox;
21+
using QStyledItemDelegate::QStyledItemDelegate;
22+
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override {
23+
QSize s = QStyledItemDelegate::sizeHint(option, index);
24+
int vertical_padding = 2;
25+
s.setHeight(option.fontMetrics.height() + vertical_padding);
26+
return s;
27+
}
28+
};
29+
30+
31+
class NoWheelCompactComboBox : public QComboBox{
32+
public:
33+
explicit NoWheelCompactComboBox(QWidget* parent = nullptr) : QComboBox(parent) {
34+
// Set the height for every line in the dropdown
35+
this->view()->setItemDelegate(new HeightDelegate(this));
36+
37+
// this->setStyleSheet("QAbstractItemView::item { height: 100px; }");
38+
39+
// Optional: Force a standard list view to ensure the stylesheet
40+
// is respected on all platforms (like Windows/macOS)
41+
// #include <QListView>
42+
// this->setView(new QListView());
43+
}
2044

2145
void update_size_cache(){
2246
#ifdef PA_ENABLE_SIZE_CACHING

Common/Qt/Options/EnumDropdownWidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ EnumDropdownCellWidget::~EnumDropdownCellWidget(){
2222
m_value.remove_listener(*this);
2323
}
2424
EnumDropdownCellWidget::EnumDropdownCellWidget(QWidget& parent, IntegerEnumDropdownCell& value)
25-
: NoWheelComboBox(&parent)
25+
: NoWheelCompactComboBox(&parent)
2626
, ConfigWidget(value, *this)
2727
, m_value(value)
2828
{

Common/Qt/Options/EnumDropdownWidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace PokemonAutomation{
1616

1717

18-
class EnumDropdownCellWidget : public NoWheelComboBox, public ConfigWidget{
18+
class EnumDropdownCellWidget : public NoWheelCompactComboBox, public ConfigWidget{
1919
public:
2020
using ParentOption = IntegerEnumDropdownCell;
2121

SerialPrograms/Source/CommonFramework/AudioPipeline/UI/AudioSelectorWidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ AudioSelectorWidget::AudioSelectorWidget(QWidget& parent, AudioSession& session)
5353
layout1->addLayout(input_layout, CONSOLE_SETTINGS_STRETCH_L1_BODY);
5454
layout1->addSpacing(5);
5555

56-
m_audio_input_box = new NoWheelComboBox(this);
56+
m_audio_input_box = new NoWheelCompactComboBox(this);
5757
m_audio_input_box->setMaxVisibleItems(20);
5858
input_layout->addWidget(m_audio_input_box);
5959

60-
m_audio_format_box = new NoWheelComboBox(this);
60+
m_audio_format_box = new NoWheelCompactComboBox(this);
6161
layout1->addWidget(m_audio_format_box, CONSOLE_SETTINGS_STRETCH_L1_RIGHT);
6262
layout1->addSpacing(5);
6363

@@ -80,7 +80,7 @@ AudioSelectorWidget::AudioSelectorWidget(QWidget& parent, AudioSession& session)
8080
layout1->addLayout(output_layout, CONSOLE_SETTINGS_STRETCH_L1_BODY);
8181
layout1->addSpacing(5);
8282

83-
m_audio_output_box = new NoWheelComboBox(this);
83+
m_audio_output_box = new NoWheelCompactComboBox(this);
8484
m_audio_output_box->setMaxVisibleItems(20);
8585
if (GlobalSettings::instance().AUDIO_PIPELINE->SHOW_RECORD_FREQUENCIES){
8686
output_layout->addWidget(m_audio_output_box, 7);
@@ -98,7 +98,7 @@ AudioSelectorWidget::AudioSelectorWidget(QWidget& parent, AudioSession& session)
9898
layout1->addWidget(m_volume_slider, 2);
9999
layout1->addSpacing(5);
100100

101-
m_audio_vis_box = new NoWheelComboBox(this);
101+
m_audio_vis_box = new NoWheelCompactComboBox(this);
102102
m_audio_vis_box->addItem("No Display");
103103
m_audio_vis_box->addItem("Spectrum");
104104
m_audio_vis_box->addItem("Spectrogram");

SerialPrograms/Source/CommonFramework/Panels/UI/PanelListWidget.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,27 @@ PanelListWidget::PanelListWidget(
3535
, m_panel_holder(holder)
3636
{
3737
// QFontMetrics fm(this->font());
38+
// this->setStyleSheet(
39+
// "QListWidget::item {"
40+
// " margin: 0px;"
41+
// " padding: 0px;" // Removes internal padding
42+
// " border: none;"
43+
// " height: 20px;" // FORCE a specific height (adjust this number)
44+
// "}"
45+
// );
46+
47+
int vertical_padding = 2;
48+
int row_height = this->fontMetrics().height() + vertical_padding;
3849
for (PanelEntry& item : list){
3950
const std::string& display_name = item.display_name;
4051
PanelDescriptor* descriptor = item.descriptor.get();
4152

53+
addItem(QString::fromStdString(display_name));
54+
QListWidgetItem* list_item = this->item(this->count() - 1);
55+
list_item->setData(Qt::SizeHintRole, QSize(0, row_height));
56+
4257
// Label/divider
4358
if (descriptor == nullptr){
44-
addItem(QString::fromStdString(display_name));
45-
QListWidgetItem* list_item = this->item(this->count() - 1);
4659
QFont font = list_item->font();
4760
font.setBold(true);
4861
list_item->setFont(font);
@@ -55,9 +68,7 @@ PanelListWidget::PanelListWidget(
5568
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Duplicate program name: " + display_name);
5669
}
5770

58-
addItem(QString::fromStdString(display_name));
5971
// addItem(QString::fromStdString("DM Elvis for FREE SHINIES!!!"));
60-
QListWidgetItem* list_item = this->item(this->count() - 1);
6172
Color color = descriptor->color();
6273
if (color){
6374
QColor qcolor = QColor((uint32_t)color);

SerialPrograms/Source/CommonFramework/VideoPipeline/UI/VideoSourceSelectorWidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ VideoSourceSelectorWidget::VideoSourceSelectorWidget(Logger& logger, VideoSessio
3939
layout0->addLayout(layout1, CONSOLE_SETTINGS_STRETCH_L0_RIGHT);
4040
layout1->setContentsMargins(0, 0, 0, 0);
4141

42-
m_sources_box = new NoWheelComboBox(this);
42+
m_sources_box = new NoWheelCompactComboBox(this);
4343
m_sources_box->setMaxVisibleItems(20);
4444
layout1->addWidget(m_sources_box, CONSOLE_SETTINGS_STRETCH_L1_BODY);
4545
layout1->addSpacing(5);
4646

47-
m_resolution_box = new NoWheelComboBox(this);
47+
m_resolution_box = new NoWheelCompactComboBox(this);
4848
m_resolution_box->setMaxVisibleItems(20);
4949
layout1->addWidget(m_resolution_box, CONSOLE_SETTINGS_STRETCH_L1_RIGHT);
5050
layout1->addSpacing(5);

SerialPrograms/Source/CommonFramework/Windows/MainWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ MainWindow::MainWindow(QWidget* parent)
7878
QVBoxLayout* program_layout = new QVBoxLayout(program_box);
7979
program_layout->setAlignment(Qt::AlignTop);
8080

81-
// NoWheelComboBox* program_dropdown = new NoWheelComboBox(this);
81+
// NoWheelCompactComboBox* program_dropdown = new NoWheelCompactComboBox(this);
8282
// program_layout->addWidget(program_dropdown);
8383

8484
m_program_list = new ProgramTabs(*this, *this);

SerialPrograms/Source/CommonTools/Options/QtWidgets/LanguageOCRWidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ LanguageOCRCellWidget::LanguageOCRCellWidget(QWidget& parent, LanguageOCRCell& v
3434
{
3535
QVBoxLayout* vbox = new QVBoxLayout(this);
3636
vbox->setContentsMargins(0, 0, 0, 0);
37-
m_box = new NoWheelComboBox(&parent);
37+
m_box = new NoWheelCompactComboBox(&parent);
3838

3939
for (const auto& item : m_value.m_case_list){
4040
// m_enum_to_index[item.first] = (int)m_index_to_enum.size();

SerialPrograms/Source/CommonTools/Options/QtWidgets/StringSelectWidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ StringSelectCellWidget::~StringSelectCellWidget(){
3030
m_value.remove_listener(*this);
3131
}
3232
StringSelectCellWidget::StringSelectCellWidget(QWidget& parent, StringSelectCell& value)
33-
: NoWheelComboBox(&parent)
33+
: NoWheelCompactComboBox(&parent)
3434
, ConfigWidget(value, *this)
3535
, m_value(value)
3636
{
@@ -129,7 +129,7 @@ void StringSelectCellWidget::hide_options(){
129129

130130
}
131131
QSize StringSelectCellWidget::sizeHint() const{
132-
QSize ret = NoWheelComboBox::sizeHint();
132+
QSize ret = NoWheelCompactComboBox::sizeHint();
133133
// cout << ret.width() << " x " << ret.height() << endl;
134134

135135
double width = ret.width();
@@ -143,11 +143,11 @@ QSize StringSelectCellWidget::sizeHint() const{
143143
void StringSelectCellWidget::focusInEvent(QFocusEvent* event){
144144
// cout << "focusInEvent()" << endl;
145145
update_value();
146-
NoWheelComboBox::focusInEvent(event);
146+
NoWheelCompactComboBox::focusInEvent(event);
147147
}
148148
void StringSelectCellWidget::focusOutEvent(QFocusEvent* event){
149149
// cout << "focusOutEvent()" << endl;
150-
NoWheelComboBox::focusOutEvent(event);
150+
NoWheelCompactComboBox::focusOutEvent(event);
151151
// update_value();
152152
}
153153
void StringSelectCellWidget::update_value(){

0 commit comments

Comments
 (0)