Table layout for notifications
This commit is contained in:
parent
581d40010f
commit
fe31f54b97
@ -1365,6 +1365,7 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
|
|||||||
// setup notifications table view
|
// setup notifications table view
|
||||||
//
|
//
|
||||||
QMap<QString, QString> notifyRows = {
|
QMap<QString, QString> notifyRows = {
|
||||||
|
{"notify_start", "JS8Call Start"},
|
||||||
{"notify_cq", "CQ Message Received"},
|
{"notify_cq", "CQ Message Received"},
|
||||||
{"notify_hb", "HB Message Received"},
|
{"notify_hb", "HB Message Received"},
|
||||||
{"notify_directed", "Directed Message Received"},
|
{"notify_directed", "Directed Message Received"},
|
||||||
@ -1375,51 +1376,84 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
auto table = ui_->notifications_table_widget;
|
auto table = ui_->notifications_table_widget;
|
||||||
|
auto header = table->horizontalHeader();
|
||||||
|
header->setStretchLastSection(false);
|
||||||
|
header->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||||
|
header->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||||
|
header->setSectionResizeMode(2, QHeaderView::Stretch);
|
||||||
|
header->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
||||||
|
|
||||||
foreach(QString key, notifyRows.keys()){
|
foreach(QString key, notifyRows.keys()){
|
||||||
QCheckBox *vcb;
|
bool enabled = false;
|
||||||
auto w1 = centeredCheckBox(this, &vcb);
|
QString path = "";
|
||||||
if(vcb){
|
|
||||||
vcb->setChecked(true);
|
QCheckBox *enabledCheckbox;
|
||||||
|
auto enabledWidget = centeredCheckBox(this, &enabledCheckbox);
|
||||||
|
enabledWidget->setMinimumWidth(100);
|
||||||
|
if(enabledCheckbox){
|
||||||
|
enabledCheckbox->setChecked(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
QCheckBox *acb;
|
auto expandingPolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
auto w2 = centeredCheckBox(this, &acb);
|
expandingPolicy.setHorizontalStretch(1);
|
||||||
if(acb){
|
|
||||||
acb->setChecked(true);
|
QLabel *pathLabel = new QLabel(this);
|
||||||
|
pathLabel->setText(path);
|
||||||
|
pathLabel->setSizePolicy(expandingPolicy);
|
||||||
|
|
||||||
|
auto minimumPolicy = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
|
minimumPolicy.setHorizontalStretch(0);
|
||||||
|
|
||||||
|
QWidget *buttonWidget = new QWidget(this);
|
||||||
|
buttonWidget->setSizePolicy(minimumPolicy);
|
||||||
|
|
||||||
|
QHBoxLayout *buttonLayout = new QHBoxLayout(buttonWidget);
|
||||||
|
buttonLayout->setStretch(0, 0);
|
||||||
|
buttonLayout->setStretch(1, 0);
|
||||||
|
buttonLayout->setContentsMargins(9,1,1,1);
|
||||||
|
buttonWidget->setLayout(buttonLayout);
|
||||||
|
|
||||||
|
QPushButton *selectFilePushButton = new QPushButton(this);
|
||||||
|
selectFilePushButton->setSizePolicy(minimumPolicy);
|
||||||
|
selectFilePushButton->setText("Select");
|
||||||
|
buttonLayout->addWidget(selectFilePushButton);
|
||||||
|
|
||||||
|
connect(selectFilePushButton, &QPushButton::pressed, this, [this, pathLabel](){
|
||||||
|
auto dir = QStandardPaths::standardLocations(QStandardPaths::MusicLocation);
|
||||||
|
auto path = QFileDialog::getOpenFileName(this, "Audio Notification", dir.first(), "Wave Files (*.wav);;All files (*.*)");
|
||||||
|
if(!path.isEmpty()){
|
||||||
|
pathLabel->setText(path);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
QWidget *w3 = new QWidget(this);
|
QPushButton *clearPushButton = new QPushButton(this);
|
||||||
QHBoxLayout *l3 = new QHBoxLayout(w3);
|
clearPushButton->setSizePolicy(minimumPolicy);
|
||||||
l3->setContentsMargins(9,1,1,1);
|
clearPushButton->setText("Clear");
|
||||||
w3->setLayout(l3);
|
buttonLayout->addWidget(clearPushButton);
|
||||||
|
|
||||||
QLabel *sflb = new QLabel(this);
|
connect(clearPushButton, &QPushButton::pressed, this, [this, pathLabel, enabledCheckbox](){
|
||||||
sflb->setText("/tmp/file.wav");
|
pathLabel->clear();
|
||||||
l3->addWidget(sflb);
|
enabledCheckbox->setChecked(false);
|
||||||
|
});
|
||||||
|
|
||||||
QPushButton *sfpb1 = new QPushButton(this);
|
// row config
|
||||||
sfpb1->setText("Select");
|
int col = 0;
|
||||||
l3->addWidget(sfpb1);
|
|
||||||
|
|
||||||
QPushButton *sfpb3 = new QPushButton(this);
|
|
||||||
sfpb3->setText("Clear");
|
|
||||||
l3->addWidget(sfpb3);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
table->insertRow(i);
|
table->insertRow(i);
|
||||||
|
|
||||||
auto labelItem = new QTableWidgetItem(notifyRows.value(key));
|
//
|
||||||
table->setItem(i, 0, labelItem);
|
auto eventLabelItem = new QTableWidgetItem(notifyRows.value(key));
|
||||||
table->setCellWidget(i, 1, w1);
|
table->setItem(i, col++, eventLabelItem);
|
||||||
table->setCellWidget(i, 2, w2);
|
|
||||||
table->setCellWidget(i, 3, w3);
|
table->setCellWidget(i, col++, enabledWidget);
|
||||||
|
|
||||||
|
table->setCellWidget(i, col++, pathLabel);
|
||||||
|
|
||||||
|
table->setCellWidget(i, col++, buttonWidget);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
table->resizeColumnToContents(0);
|
for(int i = 0, len = table->columnCount(); i < len; i++){
|
||||||
table->resizeColumnToContents(1);
|
table->resizeColumnToContents(i);
|
||||||
table->resizeColumnToContents(2);
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// setup stations table model & view
|
// setup stations table model & view
|
||||||
|
@ -278,7 +278,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>724</width>
|
<width>615</width>
|
||||||
<height>508</height>
|
<height>508</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -793,8 +793,8 @@ text message.</string>
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>738</width>
|
<width>616</width>
|
||||||
<height>453</height>
|
<height>331</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||||
@ -1517,7 +1517,7 @@ a few, particularly some Kenwood rigs, require it).</string>
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>718</width>
|
<width>494</width>
|
||||||
<height>490</height>
|
<height>490</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -1921,8 +1921,8 @@ this setting allows you to select which audio input will be used
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>760</width>
|
<width>266</width>
|
||||||
<height>502</height>
|
<height>420</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||||
@ -2305,7 +2305,7 @@ both here.</string>
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>746</width>
|
<width>562</width>
|
||||||
<height>663</height>
|
<height>663</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -2800,8 +2800,8 @@ for assessing propagation and system performance.</string>
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>760</width>
|
<width>487</width>
|
||||||
<height>502</height>
|
<height>341</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_31">
|
<layout class="QVBoxLayout" name="verticalLayout_31">
|
||||||
@ -3166,7 +3166,7 @@ QListView::item:hover {
|
|||||||
<enum>QAbstractItemView::NoSelection</enum>
|
<enum>QAbstractItemView::NoSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="showGrid">
|
<property name="showGrid">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||||
<number>125</number>
|
<number>125</number>
|
||||||
@ -3184,12 +3184,7 @@ QListView::item:hover {
|
|||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Visual Alert?</string>
|
<string>Enabled</string>
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Audio Alert?</string>
|
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
@ -3197,6 +3192,11 @@ QListView::item:hover {
|
|||||||
<string>Sound File</string>
|
<string>Sound File</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -3270,8 +3270,8 @@ QListView::item:hover {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>724</width>
|
<width>274</width>
|
||||||
<height>418</height>
|
<height>690</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||||
|
Loading…
Reference in New Issue
Block a user