mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-10 14:23:31 -05:00
Improved free text macro functionality.
The macro edit page in the settings dialog now allows multiple items to be selected in an extended selection. The macro items can be rearranged by drag and drop of single items or whole selections. The delete button and context menu item will now delete all the selected items. The free text macro drop down combo boxes on the main screen now automatically insert new macros into the macros list (at the end) if the ENTER key is pressed while the combobox has focus. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4038 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
ed2de0ed08
commit
2e8c4c4ec0
@ -148,6 +148,23 @@ private:
|
||||
QLineEdit description_;
|
||||
};
|
||||
|
||||
class RearrangableMacrosModel
|
||||
: public QStringListModel
|
||||
{
|
||||
public:
|
||||
Qt::ItemFlags flags (QModelIndex const& index) const override
|
||||
{
|
||||
auto flags = QStringListModel::flags (index);
|
||||
if (index.isValid ())
|
||||
{
|
||||
// disallow drop onto existing items
|
||||
flags &= ~Qt::ItemIsDropEnabled;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Fields that are transceiver related.
|
||||
//
|
||||
// These are aggregated in a structure to enable a non-equivalence to
|
||||
@ -268,6 +285,7 @@ private:
|
||||
|
||||
Q_SLOT void on_add_macro_line_edit_editingFinished ();
|
||||
Q_SLOT void delete_macro ();
|
||||
void delete_selected_macros (QModelIndexList);
|
||||
|
||||
Q_SLOT void on_save_path_select_push_button_clicked (bool);
|
||||
|
||||
@ -318,7 +336,7 @@ private:
|
||||
float jt9w_max_dt_;
|
||||
|
||||
QStringListModel macros_;
|
||||
QStringListModel next_macros_;
|
||||
RearrangableMacrosModel next_macros_;
|
||||
QAction * macro_delete_action_;
|
||||
|
||||
Bands bands_;
|
||||
@ -1222,6 +1240,9 @@ bool Configuration::impl::validate ()
|
||||
|
||||
int Configuration::impl::exec ()
|
||||
{
|
||||
// macros can be modified in the main window
|
||||
next_macros_.setStringList (macros_.stringList ());
|
||||
|
||||
ptt_state_ = false;
|
||||
have_rig_ = rig_active_; // record that we started with a rig open
|
||||
|
||||
@ -1596,21 +1617,48 @@ void Configuration::impl::on_add_macro_line_edit_editingFinished ()
|
||||
|
||||
void Configuration::impl::on_delete_macro_push_button_clicked (bool /* checked */)
|
||||
{
|
||||
auto index = ui_->macros_list_view->selectionModel ()->currentIndex ();
|
||||
if (index.isValid ())
|
||||
auto selection_model = ui_->macros_list_view->selectionModel ();
|
||||
if (selection_model->hasSelection ())
|
||||
{
|
||||
next_macros_.removeRow (index.row ());
|
||||
// delete all selected items
|
||||
delete_selected_macros (selection_model->selectedRows ());
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::impl::delete_macro ()
|
||||
{
|
||||
auto index = ui_->macros_list_view->currentIndex ();
|
||||
auto selection_model = ui_->macros_list_view->selectionModel ();
|
||||
if (!selection_model->hasSelection ())
|
||||
{
|
||||
// delete item under cursor if any
|
||||
auto index = selection_model->currentIndex ();
|
||||
if (index.isValid ())
|
||||
{
|
||||
next_macros_.removeRow (index.row ());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// delete the whole selection
|
||||
delete_selected_macros (selection_model->selectedRows ());
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::impl::delete_selected_macros (QModelIndexList selected_rows)
|
||||
{
|
||||
// sort in reverse row order so that we can delete without changing
|
||||
// indices underneath us
|
||||
qSort (selected_rows.begin (), selected_rows.end (), [] (QModelIndex const& lhs, QModelIndex const& rhs)
|
||||
{
|
||||
return rhs.row () < lhs.row (); // reverse row ordering
|
||||
});
|
||||
|
||||
// now delete them
|
||||
Q_FOREACH (auto index, selected_rows)
|
||||
{
|
||||
next_macros_.removeRow (index.row ());
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::impl::on_add_macro_push_button_clicked (bool /* checked */)
|
||||
{
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>508</width>
|
||||
<height>471</height>
|
||||
<width>586</width>
|
||||
<height>550</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -1390,6 +1390,11 @@ both here.</string>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Drag and drop items to rearrange order
|
||||
Right click for item specific actions
|
||||
Click, SHIFT+Click and, CRTL+Click to select items</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QListView {
|
||||
show-decoration-selected: 1; /* make the selection span the entire width of the view */
|
||||
@ -1418,8 +1423,17 @@ QListView::item:hover {
|
||||
stop: 0 #FAFBFE, stop: 1 #DCDEF1);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
<property name="defaultDropAction">
|
||||
<enum>Qt::MoveAction</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>true</bool>
|
||||
@ -1801,12 +1815,12 @@ soundcard changes</string>
|
||||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="TX_audio_source_button_group"/>
|
||||
<buttongroup name="TX_mode_button_group"/>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="CAT_stop_bits_button_group"/>
|
||||
<buttongroup name="PTT_method_button_group"/>
|
||||
<buttongroup name="CAT_data_bits_button_group"/>
|
||||
<buttongroup name="CAT_handshake_button_group"/>
|
||||
<buttongroup name="TX_audio_source_button_group"/>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="PTT_method_button_group"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
338
mainwindow.ui
338
mainwindow.ui
@ -591,6 +591,46 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="2" column="6">
|
||||
<widget class="QSpinBox" name="TxFreqSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>113</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Audio Tx frequency</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> Hz</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>Tx </string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>5000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="labAz">
|
||||
<property name="sizePolicy">
|
||||
@ -876,46 +916,6 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QSpinBox" name="TxFreqSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>113</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Audio Tx frequency</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> Hz</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>Tx </string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>5000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" colspan="2">
|
||||
<widget class="QLabel" name="labDialFreq">
|
||||
<property name="sizePolicy">
|
||||
@ -985,6 +985,28 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QCheckBox" name="txFirstCheckBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check to Tx in even minutes, uncheck for odd minutes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tx even</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
@ -1077,74 +1099,6 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" rowspan="5">
|
||||
<widget class="QSlider" name="inGain">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Digital gain for audio input</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-50</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="invertedControls">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QCheckBox" name="txFirstCheckBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check to Tx in even minutes, uncheck for odd minutes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tx even</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QPushButton" name="pbTxMode">
|
||||
<property name="enabled">
|
||||
@ -1158,6 +1112,16 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="cbPlus2kHz">
|
||||
<property name="toolTip">
|
||||
<string>Add 2 kHz to requested dial frequency</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+2 kHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3" rowspan="2" colspan="2">
|
||||
<widget class="QLabel" name="labUTC">
|
||||
<property name="sizePolicy">
|
||||
@ -1203,13 +1167,19 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="cbPlus2kHz">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="readFreq">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>15</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add 2 kHz to requested dial frequency</string>
|
||||
<string><html><head/><body><p>If orange, click to read dial frequency</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+2 kHz</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1273,7 +1243,7 @@ p, li { white-space: pre-wrap; }
|
||||
<enum>QTabWidget::Triangular</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@ -1778,11 +1748,17 @@ p, li { white-space: pre-wrap; }
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enter a free text message (maximum 13 characters)
|
||||
or select a predefined macro from the dropdown list.
|
||||
Press ENTER to add the current text to the predefined
|
||||
list. The list can be maintained in Settings (F2).</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
<enum>QComboBox::InsertAtBottom</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1990,11 +1966,17 @@ p, li { white-space: pre-wrap; }
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enter a free text message (maximum 13 characters)
|
||||
or select a predefined macro from the dropdown list.
|
||||
Press ENTER to add the current text to the predefined
|
||||
list. The list can be maintained in Settings (F2).</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
<enum>QComboBox::InsertAtBottom</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -2031,19 +2013,10 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="readFreq">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>15</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>If orange, click to read dial frequency</p></body></html></string>
|
||||
</property>
|
||||
<item row="0" column="9">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Pwr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -2063,6 +2036,34 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="9" rowspan="6">
|
||||
<widget class="QSlider" name="outAttenuation">
|
||||
<property name="toolTip">
|
||||
<string>Adjust Tx audio level</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="invertedControls">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QComboBox" name="bandComboBox">
|
||||
<property name="sizePolicy">
|
||||
@ -2094,41 +2095,6 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Pwr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="9" rowspan="6">
|
||||
<widget class="QSlider" name="outAttenuation">
|
||||
<property name="toolTip">
|
||||
<string>Adjust Tx audio level</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="invertedControls">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="7">
|
||||
<widget class="QPushButton" name="pbT2R">
|
||||
<property name="sizePolicy">
|
||||
@ -2237,6 +2203,52 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1" rowspan="5">
|
||||
<widget class="QSlider" name="inGain">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Digital gain for audio input</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-50</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="invertedControls">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -2247,7 +2259,7 @@ p, li { white-space: pre-wrap; }
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>780</width>
|
||||
<height>21</height>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
Loading…
Reference in New Issue
Block a user