forked from Ivasoft/DSView
fix combobox's bug at macos
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=DSView
|
||||
Comment=GUI Program for DreamSourceLab USB-based Instruments
|
||||
TryExec=DSView
|
||||
Exec=DSView
|
||||
Icon=dsview
|
||||
Terminal=false
|
||||
Categories=Development;Electronics;Qt;
|
||||
@@ -144,12 +144,13 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
} else if (argcFinal - optind == 1)
|
||||
open_file = argvFinal[argcFinal - 1];
|
||||
|
||||
// Initialise DS_RES_PATH
|
||||
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
if (dir.cd("..") &&
|
||||
dir.cd("share") &&
|
||||
dir.cd(QApplication::applicationName()) &&
|
||||
dir.cd("DSView") &&
|
||||
dir.cd("res")) {
|
||||
// the path command like: cd ../share/DSView/res
|
||||
QString res_dir = dir.absolutePath() + "/";
|
||||
@@ -158,6 +159,10 @@ int main(int argc, char *argv[])
|
||||
qDebug() << "DSView run ERROR: config files don't exist.";
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//#ifdef Q_OS_DARWIN
|
||||
//#endif
|
||||
|
||||
//load app config
|
||||
AppConfig::Instance().LoadAll();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "ZipMaker.h"
|
||||
#include <assert.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
@@ -251,7 +251,7 @@ const char *ZipMaker::GetError()
|
||||
unzOpenCurrentFile((unzFile)m_uzDoc);
|
||||
|
||||
//read file data to buffer
|
||||
void *buf = inf.pData;
|
||||
char *buf = (char*)inf.pData;
|
||||
long long buflen = inf.dataLen;
|
||||
long long rdlen = 0;
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include <libsigrok4DSL/libsigrok.h>
|
||||
#include <libsigrokdecode4DSL/libsigrokdecode.h>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "devicemanager.h"
|
||||
#include "sigsession.h"
|
||||
@@ -72,7 +74,17 @@ bool AppControl::Init()
|
||||
}
|
||||
|
||||
// const char *decoderScriptDir = "/home/lala/tmpdir/any";
|
||||
const char * decoderScriptDir = NULL;
|
||||
//const char * decoderScriptDir = NULL;
|
||||
|
||||
char decoderScriptDir[256] = {0};
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
#ifdef Q_OS_LINUX
|
||||
dir.cd("../share/DSView/decoders");
|
||||
#else
|
||||
dir.cd("decoders");
|
||||
#endif
|
||||
|
||||
strcpy(decoderScriptDir, dir.absolutePath().toUtf8().data());
|
||||
|
||||
// Initialise libsigrokdecode
|
||||
if (srd_init(decoderScriptDir) != SRD_OK)
|
||||
|
||||
@@ -391,7 +391,7 @@ void DeviceOptions::analog_channel_check()
|
||||
}
|
||||
}
|
||||
dynamic_widget(_dynamic_layout);
|
||||
_dynamic_box->setVisible(_dynamic_box->title() != NULL);
|
||||
_dynamic_box->setVisible(_dynamic_box->title() != "");
|
||||
}
|
||||
|
||||
void DeviceOptions::channel_enable()
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <QVector>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QRadioButton>
|
||||
#include <QTimer>
|
||||
|
||||
@@ -44,6 +43,7 @@
|
||||
#include "../prop/binding/probeoptions.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
#include "../dialogs/dsdialog.h"
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
using namespace pv::device;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "../view/trace.h"
|
||||
#include "../view/dsosignal.h"
|
||||
#include "../view/spectrumtrace.h"
|
||||
#include "../dsvdef.h"
|
||||
|
||||
|
||||
using namespace boost;
|
||||
@@ -58,15 +59,15 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) :
|
||||
_layout = NULL;
|
||||
|
||||
_en_checkbox = new QCheckBox(this);
|
||||
_len_combobox = new QComboBox(this);
|
||||
_interval_combobox = new QComboBox(this);
|
||||
_ch_combobox = new QComboBox(this);
|
||||
_window_combobox = new QComboBox(this);
|
||||
_len_combobox = new DsComboBox(this);
|
||||
_interval_combobox = new DsComboBox(this);
|
||||
_ch_combobox = new DsComboBox(this);
|
||||
_window_combobox = new DsComboBox(this);
|
||||
_dc_checkbox = new QCheckBox(this);
|
||||
_dc_checkbox->setChecked(true);
|
||||
_view_combobox = new QComboBox(this);
|
||||
_dbv_combobox = new QComboBox(this);
|
||||
|
||||
_view_combobox = new DsComboBox(this);
|
||||
_dbv_combobox = new DsComboBox(this);
|
||||
|
||||
// setup _ch_combobox
|
||||
for(auto &s : _session->get_signals()) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
@@ -217,9 +218,9 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) :
|
||||
|
||||
connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(&_button_box, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(_window_combobox, SIGNAL(currentIndexChanged(QString)), this, SLOT(window_changed(QString)));
|
||||
connect(_window_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(window_changed(int)));
|
||||
connect(_len_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(len_changed(int)));
|
||||
connect(_session->get_device(), SIGNAL(device_updated()), this, SLOT(reject()));
|
||||
connect(_session->get_device(), SIGNAL(device_updated()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
FftOptions::~FftOptions(){
|
||||
@@ -261,8 +262,9 @@ void FftOptions::reject()
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void FftOptions::window_changed(QString str)
|
||||
void FftOptions::window_changed(int index)
|
||||
{
|
||||
QString str = _window_combobox->itemText(index);
|
||||
QString hint_pic= ":/icons/" + str +".png";
|
||||
QPixmap pixmap(hint_pic);
|
||||
_hint_label->setPixmap(pixmap);
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
#include <QFormLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
|
||||
|
||||
#include "../device/devinst.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
#include "dsdialog.h"
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
namespace pv {
|
||||
|
||||
@@ -58,21 +58,21 @@ protected:
|
||||
void reject();
|
||||
|
||||
private slots:
|
||||
void window_changed(QString str);
|
||||
void window_changed(int index);
|
||||
void len_changed(int index);
|
||||
|
||||
private:
|
||||
SigSession *_session;
|
||||
uint64_t _sample_limit;
|
||||
|
||||
QComboBox *_len_combobox;
|
||||
QComboBox *_interval_combobox;
|
||||
DsComboBox *_len_combobox;
|
||||
DsComboBox *_interval_combobox;
|
||||
QCheckBox *_en_checkbox;
|
||||
QComboBox *_ch_combobox;
|
||||
QComboBox *_window_combobox;
|
||||
DsComboBox *_ch_combobox;
|
||||
DsComboBox *_window_combobox;
|
||||
QCheckBox *_dc_checkbox;
|
||||
QComboBox *_view_combobox;
|
||||
QComboBox *_dbv_combobox;
|
||||
DsComboBox *_view_combobox;
|
||||
DsComboBox *_dbv_combobox;
|
||||
|
||||
QLabel *_hint_label;
|
||||
QGridLayout *_glayout;
|
||||
|
||||
@@ -52,7 +52,7 @@ ProtocolExp::ProtocolExp(QWidget *parent, SigSession *session) :
|
||||
Qt::Horizontal, this),
|
||||
_export_cancel(false)
|
||||
{
|
||||
_format_combobox = new QComboBox(this);
|
||||
_format_combobox = new DsComboBox(this);
|
||||
_format_combobox->addItem(tr("Comma-Separated Values (*.csv)"));
|
||||
_format_combobox->addItem(tr("Text files (*.txt)"));
|
||||
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QComboBox>
|
||||
|
||||
#include "../device/devinst.h"
|
||||
#include "../prop/binding/deviceoptions.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
#include "dsdialog.h"
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
namespace pv {
|
||||
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
SigSession *_session;
|
||||
|
||||
toolbars::TitleBar *_titlebar;
|
||||
QComboBox *_format_combobox;
|
||||
DsComboBox *_format_combobox;
|
||||
std::list<QRadioButton *> _row_sel_list;
|
||||
std::list<QLabel *> _row_label_list;
|
||||
QFormLayout *_flayout;
|
||||
|
||||
@@ -45,7 +45,7 @@ ProtocolList::ProtocolList(QWidget *parent, SigSession *session) :
|
||||
{
|
||||
pv::data::DecoderModel* decoder_model = _session->get_decoder_model();
|
||||
|
||||
_map_zoom_combobox = new QComboBox(this);
|
||||
_map_zoom_combobox = new DsComboBox(this);
|
||||
_map_zoom_combobox->addItem(tr("Fit to Window"));
|
||||
_map_zoom_combobox->addItem(tr("Fixed"));
|
||||
int cur_map_zoom = _session->get_map_zoom();
|
||||
@@ -57,7 +57,7 @@ ProtocolList::ProtocolList(QWidget *parent, SigSession *session) :
|
||||
|
||||
connect(_map_zoom_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_set_map_zoom(int)));
|
||||
|
||||
_protocol_combobox = new QComboBox(this);
|
||||
_protocol_combobox = new DsComboBox(this);
|
||||
auto &decode_sigs = _session->get_decode_signals();
|
||||
int index = 0;
|
||||
|
||||
|
||||
@@ -27,14 +27,13 @@
|
||||
#include <QFormLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "../device/devinst.h"
|
||||
#include "../prop/binding/deviceoptions.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
#include "dsdialog.h"
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
namespace pv {
|
||||
|
||||
@@ -62,8 +61,8 @@ private:
|
||||
SigSession *_session;
|
||||
|
||||
toolbars::TitleBar *_titlebar;
|
||||
QComboBox *_map_zoom_combobox;
|
||||
QComboBox *_protocol_combobox;
|
||||
DsComboBox *_map_zoom_combobox;
|
||||
DsComboBox *_protocol_combobox;
|
||||
std::list<QCheckBox *> _show_checkbox_list;
|
||||
std::list<QLabel *> _show_label_list;
|
||||
QFormLayout *_flayout;
|
||||
|
||||
@@ -45,8 +45,8 @@ RegionOptions::RegionOptions(view::View *view, SigSession *session, QWidget *par
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
hlayout->setContentsMargins(0,0,0,0);
|
||||
hlayout->setSpacing(0);
|
||||
_start_comboBox = new QComboBox(this);
|
||||
_end_comboBox = new QComboBox(this);
|
||||
_start_comboBox = new DsComboBox(this);
|
||||
_end_comboBox = new DsComboBox(this);
|
||||
_start_comboBox->addItem(RegionStart);
|
||||
_end_comboBox->addItem(RegionEnd);
|
||||
if (_view) {
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
|
||||
#include "../toolbars/titlebar.h"
|
||||
#include "dsdialog.h"
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
namespace pv {
|
||||
|
||||
@@ -59,8 +59,8 @@ private:
|
||||
SigSession *_session;
|
||||
view::View *_view;
|
||||
|
||||
QComboBox *_start_comboBox;
|
||||
QComboBox *_end_comboBox;
|
||||
DsComboBox *_start_comboBox;
|
||||
DsComboBox *_end_comboBox;
|
||||
|
||||
QDialogButtonBox _button_box;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ DsoTriggerDock::DsoTriggerDock(QWidget *parent, SigSession *session) :
|
||||
connect(_position_slider, SIGNAL(valueChanged(int)), this, SLOT(pos_changed(int)));
|
||||
|
||||
_holdoff_label = new QLabel(_widget);
|
||||
_holdoff_comboBox = new QComboBox(_widget);
|
||||
_holdoff_comboBox = new DsComboBox(_widget);
|
||||
_holdoff_comboBox->addItem(tr("uS"), QVariant::fromValue(1000));
|
||||
_holdoff_comboBox->addItem(tr("mS"), QVariant::fromValue(1000000));
|
||||
_holdoff_comboBox->addItem(tr("S"), QVariant::fromValue(1000000000));
|
||||
@@ -103,7 +103,7 @@ DsoTriggerDock::DsoTriggerDock(QWidget *parent, SigSession *session) :
|
||||
connect(_falling_radioButton, SIGNAL(clicked()), this, SLOT(type_changed()));
|
||||
|
||||
_source_group=new QButtonGroup(_widget);
|
||||
_channel_comboBox = new QComboBox(_widget);
|
||||
_channel_comboBox = new DsComboBox(_widget);
|
||||
_type_group=new QButtonGroup(_widget);
|
||||
|
||||
_source_group->addButton(_auto_radioButton);
|
||||
|
||||
@@ -27,12 +27,13 @@
|
||||
#include <QSpinBox>
|
||||
#include <QButtonGroup>
|
||||
#include <QScrollArea>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
namespace pv {
|
||||
|
||||
class SigSession;
|
||||
@@ -79,7 +80,7 @@ private:
|
||||
|
||||
QWidget *_widget;
|
||||
|
||||
QComboBox *_holdoff_comboBox;
|
||||
DsComboBox *_holdoff_comboBox;
|
||||
QSpinBox *_holdoff_spinBox;
|
||||
QSlider *_holdoff_slider;
|
||||
|
||||
@@ -89,7 +90,7 @@ private:
|
||||
QSlider *_position_slider;
|
||||
|
||||
QButtonGroup *_source_group;
|
||||
QComboBox *_channel_comboBox;
|
||||
DsComboBox *_channel_comboBox;
|
||||
QButtonGroup *_type_group;
|
||||
|
||||
QLabel *_position_label;
|
||||
|
||||
@@ -216,7 +216,7 @@ void MeasureDock::reload()
|
||||
else
|
||||
_edge_groupBox->setDisabled(true);
|
||||
|
||||
for (QVector <QComboBox *>::const_iterator i = _edge_ch_cmb_vec.begin();
|
||||
for (QVector <DsComboBox *>::const_iterator i = _edge_ch_cmb_vec.begin();
|
||||
i != _edge_ch_cmb_vec.end(); i++) {
|
||||
update_probe_selector(*i);
|
||||
}
|
||||
@@ -416,7 +416,7 @@ void MeasureDock::add_edge_measure()
|
||||
g_label->setContentsMargins(0,0,0,0);
|
||||
QLabel *a_label = new QLabel(tr("@"), row_widget);
|
||||
a_label->setContentsMargins(0,0,0,0);
|
||||
QComboBox *ch_cmb = create_probe_selector(row_widget);
|
||||
DsComboBox *ch_cmb = create_probe_selector(row_widget);
|
||||
_edge_del_btn_vec.push_back(del_btn);
|
||||
_edge_s_btn_vec.push_back(s_btn);
|
||||
_edge_e_btn_vec.push_back(e_btn);
|
||||
@@ -643,14 +643,14 @@ void MeasureDock::set_cursor_btn_color(QPushButton *btn)
|
||||
btn->setStyleSheet(style);
|
||||
}
|
||||
|
||||
QComboBox* MeasureDock::create_probe_selector(QWidget *parent)
|
||||
DsComboBox* MeasureDock::create_probe_selector(QWidget *parent)
|
||||
{
|
||||
QComboBox *selector = new QComboBox(parent);
|
||||
DsComboBox *selector = new DsComboBox(parent);
|
||||
update_probe_selector(selector);
|
||||
return selector;
|
||||
}
|
||||
|
||||
void MeasureDock::update_probe_selector(QComboBox *selector)
|
||||
void MeasureDock::update_probe_selector(DsComboBox *selector)
|
||||
{
|
||||
selector->clear();
|
||||
const auto &sigs = _session->get_signals();
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
@@ -42,6 +41,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
namespace pv {
|
||||
|
||||
class SigSession;
|
||||
@@ -73,8 +74,8 @@ private:
|
||||
void reStyle();
|
||||
|
||||
private:
|
||||
QComboBox* create_probe_selector(QWidget *parent);
|
||||
void update_probe_selector(QComboBox *selector);
|
||||
DsComboBox* create_probe_selector(QWidget *parent);
|
||||
void update_probe_selector(DsComboBox *selector);
|
||||
|
||||
signals:
|
||||
|
||||
@@ -129,7 +130,7 @@ private:
|
||||
QVector<QToolButton *> _edge_del_btn_vec;
|
||||
QVector<QPushButton *> _edge_s_btn_vec;
|
||||
QVector<QPushButton *> _edge_e_btn_vec;
|
||||
QVector<QComboBox *> _edge_ch_cmb_vec;
|
||||
QVector<DsComboBox *> _edge_ch_cmb_vec;
|
||||
QVector<QLabel *> _edge_r_label_vec;
|
||||
|
||||
QPushButton *_sel_btn;
|
||||
|
||||
@@ -75,7 +75,7 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio
|
||||
_del_all_button = new QPushButton(_up_widget);
|
||||
_del_all_button->setFlat(true);
|
||||
_del_all_button->setCheckable(true);
|
||||
_protocol_combobox = new QComboBox(_up_widget);
|
||||
_protocol_combobox = new DsComboBox(_up_widget);
|
||||
|
||||
GSList *l = g_slist_sort(g_slist_copy(
|
||||
(GSList*)srd_decoder_list()), decoder_name_cmp);
|
||||
@@ -248,8 +248,12 @@ void ProtocolDock::paintEvent(QPaintEvent *)
|
||||
void ProtocolDock::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
int width = this->visibleRegion().boundingRect().width();
|
||||
width = width - _dn_layout->margin() * 2 -
|
||||
_dn_search_layout->margin() * 2 -
|
||||
|
||||
int mg1 = 10;
|
||||
int mg2 = 10;
|
||||
|
||||
width = width - mg1 * 2 -
|
||||
mg2 * 2 -
|
||||
_dn_search_layout->spacing() * 2 -
|
||||
_pre_button->width()-_nxt_button->width();
|
||||
width = std::max(width, 0);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QVector>
|
||||
#include <QVBoxLayout>
|
||||
@@ -42,6 +41,7 @@
|
||||
|
||||
#include "../data/decodermodel.h"
|
||||
#include "protocolitemlayer.h"
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
|
||||
namespace pv {
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
|
||||
QPushButton *_add_button;
|
||||
QPushButton *_del_all_button;
|
||||
QComboBox *_protocol_combobox;
|
||||
DsComboBox *_protocol_combobox;
|
||||
QVector <int > _protocol_index_list;
|
||||
QVBoxLayout *_up_layout;
|
||||
QVector <ProtocolItemLayer*> _protocol_items; //protocol item layers
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "protocolitemlayer.h"
|
||||
#include "../dsvdef.h"
|
||||
#include <QtCore>
|
||||
#include <assert.h>
|
||||
#include "../config/appconfig.h"
|
||||
|
||||
@@ -40,7 +39,7 @@ ProtocolItemLayer::ProtocolItemLayer(QWidget *parent, QString protocolName, IPro
|
||||
_progress_label = new QLabel(parent);
|
||||
_set_button = new QPushButton(parent);
|
||||
_del_button = new QPushButton(parent);
|
||||
_format_combox = new QComboBox(parent);
|
||||
_format_combox = new DsComboBox(parent);
|
||||
|
||||
QString iconPath = GetIconPath();
|
||||
_del_button->setFlat(true);
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QString>
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
class DecoderStatus;
|
||||
|
||||
@@ -68,7 +67,7 @@ private:
|
||||
QLabel *_progress_label;
|
||||
QPushButton *_set_button;
|
||||
QPushButton *_del_button;
|
||||
QComboBox *_format_combox;
|
||||
DsComboBox *_format_combox;
|
||||
IProtocolItemLayerCallback *m_callback;
|
||||
QString _protocolName;
|
||||
bool m_bSetting;
|
||||
|
||||
@@ -261,7 +261,9 @@ void SearchDock::on_set()
|
||||
|
||||
_search_value->setText(search_label);
|
||||
QFontMetrics fm = this->fontMetrics();
|
||||
_search_value->setFixedWidth(fm.width(search_label)+_search_button->width()+20);
|
||||
//fm.width(search_label)
|
||||
int tw = fm.boundingRect(search_label).width();
|
||||
_search_value->setFixedWidth(tw + _search_button->width()+20);
|
||||
|
||||
if (new_pattern != _pattern) {
|
||||
_view.set_search_pos(_view.get_search_pos(), false);
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
@@ -43,6 +42,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "../widgets/fakelineedit.h"
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
namespace pv {
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession *session) :
|
||||
|
||||
_stages_label = new QLabel(_widget);
|
||||
_stages_label->setDisabled(true);
|
||||
stages_comboBox = new QComboBox(_widget);
|
||||
stages_comboBox = new DsComboBox(_widget);
|
||||
for (int i = 1; i <= TriggerStages; i++)
|
||||
stages_comboBox->addItem(QString::number(i));
|
||||
//stages_comboBox->setCurrentIndex(stages_comboBox->count() - 1);
|
||||
@@ -569,7 +569,7 @@ void TriggerDock::setup_adv_tab()
|
||||
QRegularExpression value_rx("[10XRFCxrfc ]+");
|
||||
QValidator *value_validator = new QRegularExpressionValidator(value_rx, _stage_tabWidget);
|
||||
for (int i = 0; i < TriggerStages; i++) {
|
||||
QComboBox *_logic_comboBox = new QComboBox(_stage_tabWidget);
|
||||
DsComboBox *_logic_comboBox = new DsComboBox(_stage_tabWidget);
|
||||
_logic_comboBox->addItem(tr("Or"));
|
||||
_logic_comboBox->addItem(tr("And"));
|
||||
_logic_comboBox->setCurrentIndex(1);
|
||||
@@ -586,7 +586,7 @@ void TriggerDock::setup_adv_tab()
|
||||
_count_spinBox->setRange(1, INT32_MAX);
|
||||
_count_spinBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
_count_spinBox_list.push_back(_count_spinBox);
|
||||
QComboBox *_inv0_comboBox = new QComboBox(_stage_tabWidget);
|
||||
DsComboBox *_inv0_comboBox = new DsComboBox(_stage_tabWidget);
|
||||
_inv0_comboBox->addItem(tr("=="));
|
||||
_inv0_comboBox->addItem(tr("!="));
|
||||
_inv0_comboBox_list.push_back(_inv0_comboBox);
|
||||
@@ -598,7 +598,7 @@ void TriggerDock::setup_adv_tab()
|
||||
_value1_lineEdit->setInputMask(mask);
|
||||
_value1_lineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
_value1_lineEdit_list.push_back(_value1_lineEdit);
|
||||
QComboBox *_inv1_comboBox = new QComboBox(_stage_tabWidget);
|
||||
DsComboBox *_inv1_comboBox = new DsComboBox(_stage_tabWidget);
|
||||
_inv1_comboBox->addItem(tr("=="));
|
||||
_inv1_comboBox->addItem(tr("!="));
|
||||
_inv1_comboBox_list.push_back(_inv1_comboBox);
|
||||
@@ -734,7 +734,7 @@ void TriggerDock::setup_adv_tab()
|
||||
_serial_edge_lineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
|
||||
_serial_data_label = new QLabel(_serial_groupBox);
|
||||
_serial_data_comboBox = new QComboBox(_serial_groupBox);
|
||||
_serial_data_comboBox = new DsComboBox(_serial_groupBox);
|
||||
for(int i = 0; i < _cur_ch_num; i++)
|
||||
_serial_data_comboBox->addItem(QString::number(i));
|
||||
|
||||
@@ -746,7 +746,7 @@ void TriggerDock::setup_adv_tab()
|
||||
_serial_value_lineEdit->setInputMask(mask);
|
||||
_serial_value_lineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
|
||||
_serial_bits_comboBox = new QComboBox(_serial_groupBox);
|
||||
_serial_bits_comboBox = new DsComboBox(_serial_groupBox);
|
||||
for(int i = 1; i <= 16; i++)
|
||||
_serial_bits_comboBox->addItem(QString::number(i));
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
@@ -43,6 +42,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
namespace pv {
|
||||
|
||||
class SigSession;
|
||||
@@ -108,20 +109,20 @@ private:
|
||||
QSlider *_position_slider;
|
||||
|
||||
QLabel *_stages_label;
|
||||
QComboBox *stages_comboBox;
|
||||
DsComboBox *stages_comboBox;
|
||||
|
||||
QTabWidget *_stage_tabWidget;
|
||||
|
||||
QVector <QGroupBox *> _stage_groupBox_list;
|
||||
QVector <QLabel *> _mu_label_list;
|
||||
QVector <QComboBox *> _logic_comboBox_list;
|
||||
QVector <DsComboBox *> _logic_comboBox_list;
|
||||
QVector <QLineEdit *> _value0_lineEdit_list;
|
||||
QVector <QLineEdit *> _value0_ext32_lineEdit_list;
|
||||
QVector <QSpinBox *> _count_spinBox_list;
|
||||
QVector <QComboBox *> _inv0_comboBox_list;
|
||||
QVector <DsComboBox *> _inv0_comboBox_list;
|
||||
QVector <QLineEdit *> _value1_lineEdit_list;
|
||||
QVector <QLineEdit *> _value1_ext32_lineEdit_list;
|
||||
QVector <QComboBox *> _inv1_comboBox_list;
|
||||
QVector <DsComboBox *> _inv1_comboBox_list;
|
||||
QVector <QCheckBox *> _contiguous_checkbox_list;
|
||||
|
||||
QTabWidget *_adv_tabWidget;
|
||||
@@ -136,10 +137,10 @@ private:
|
||||
QLineEdit *_serial_edge_lineEdit;
|
||||
QLineEdit *_serial_edge_ext32_lineEdit;
|
||||
QLabel *_serial_data_label;
|
||||
QComboBox *_serial_data_comboBox;
|
||||
DsComboBox *_serial_data_comboBox;
|
||||
QLabel *_serial_value_label;
|
||||
QLineEdit *_serial_value_lineEdit;
|
||||
QComboBox *_serial_bits_comboBox;
|
||||
DsComboBox *_serial_bits_comboBox;
|
||||
|
||||
QLabel *_serial_note_label;
|
||||
QLabel *_data_bits_label;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../config.h"
|
||||
#include <QString>
|
||||
|
||||
|
||||
#ifdef DS_DEBUG_TRACE
|
||||
|
||||
47
DSView/pv/mainframe.cpp
Executable file → Normal file
47
DSView/pv/mainframe.cpp
Executable file → Normal file
@@ -36,7 +36,6 @@
|
||||
#include <QDialogButtonBox>
|
||||
#include <QBitmap>
|
||||
#include <QResizeEvent>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDesktopServices>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
@@ -229,7 +228,15 @@ bool MainFrame::eventFilter(QObject *object, QEvent *event)
|
||||
return QFrame::eventFilter(object, event);
|
||||
}
|
||||
|
||||
if (!_bDraging && type == QEvent::MouseMove && (!(mouse_event->buttons() || Qt::NoButton))){
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
int x0 = (int)mouse_event->globalPosition().x();
|
||||
int y0 = (int)mouse_event->globalPosition().y();
|
||||
#else
|
||||
int x0 = mouse_event->globalX();
|
||||
int y0 = mouse_event->globalY();
|
||||
#endif
|
||||
|
||||
if (!_bDraging && type == QEvent::MouseMove && (!(mouse_event->buttons() | Qt::NoButton))){
|
||||
if (object == _top_left) {
|
||||
_hit_border = TopLeft;
|
||||
setCursor(Qt::SizeFDiagCursor);
|
||||
@@ -267,55 +274,55 @@ bool MainFrame::eventFilter(QObject *object, QEvent *event)
|
||||
if (!_freezing) {
|
||||
switch (_hit_border) {
|
||||
case TopLeft:
|
||||
newWidth = std::max(_dragStartGeometry.right() - mouse_event->globalX(), minimumWidth());
|
||||
newHeight = std::max(_dragStartGeometry.bottom() - mouse_event->globalY(), minimumHeight());
|
||||
newWidth = std::max(_dragStartGeometry.right() - x0, minimumWidth());
|
||||
newHeight = std::max(_dragStartGeometry.bottom() - y0, minimumHeight());
|
||||
newLeft = geometry().left();
|
||||
newTop = geometry().top();
|
||||
if (newWidth > minimumWidth())
|
||||
newLeft = mouse_event->globalX();
|
||||
newLeft = x0;
|
||||
if (newHeight > minimumHeight())
|
||||
newTop = mouse_event->globalY();
|
||||
newTop = y0;
|
||||
setGeometry(newLeft, newTop, newWidth, newHeight);
|
||||
saveWindowRegion();
|
||||
break;
|
||||
|
||||
case BottomLeft:
|
||||
newWidth = std::max(_dragStartGeometry.right() - mouse_event->globalX(), minimumWidth());
|
||||
newHeight = std::max(mouse_event->globalY() - _dragStartGeometry.top(), minimumHeight());
|
||||
newWidth = std::max(_dragStartGeometry.right() - x0, minimumWidth());
|
||||
newHeight = std::max(y0 - _dragStartGeometry.top(), minimumHeight());
|
||||
newLeft = geometry().left();
|
||||
if (newWidth > minimumWidth())
|
||||
newLeft = mouse_event->globalX();
|
||||
newLeft = x0;
|
||||
setGeometry(newLeft, _dragStartGeometry.top(), newWidth, newHeight);
|
||||
saveWindowRegion();
|
||||
break;
|
||||
|
||||
case TopRight:
|
||||
newWidth = std::max(mouse_event->globalX() - _dragStartGeometry.left(), minimumWidth());
|
||||
newHeight = std::max(_dragStartGeometry.bottom() - mouse_event->globalY(), minimumHeight());
|
||||
newWidth = std::max(x0 - _dragStartGeometry.left(), minimumWidth());
|
||||
newHeight = std::max(_dragStartGeometry.bottom() - y0, minimumHeight());
|
||||
newTop = geometry().top();
|
||||
if (newHeight > minimumHeight())
|
||||
newTop = mouse_event->globalY();
|
||||
newTop = y0;
|
||||
setGeometry(_dragStartGeometry.left(), newTop, newWidth, newHeight);
|
||||
saveWindowRegion();
|
||||
break;
|
||||
|
||||
case BottomRight:
|
||||
newWidth = std::max(mouse_event->globalX() - _dragStartGeometry.left(), minimumWidth());
|
||||
newHeight = std::max(mouse_event->globalY() - _dragStartGeometry.top(), minimumHeight());
|
||||
newWidth = std::max(x0 - _dragStartGeometry.left(), minimumWidth());
|
||||
newHeight = std::max(y0 - _dragStartGeometry.top(), minimumHeight());
|
||||
setGeometry(_dragStartGeometry.left(), _dragStartGeometry.top(), newWidth, newHeight);
|
||||
saveWindowRegion();
|
||||
break;
|
||||
|
||||
case Left:
|
||||
newWidth = _dragStartGeometry.right() - mouse_event->globalX();
|
||||
newWidth = _dragStartGeometry.right() - x0;
|
||||
if (newWidth > minimumWidth()){
|
||||
setGeometry(mouse_event->globalX(), _dragStartGeometry.top(), newWidth, height());
|
||||
setGeometry(x0, _dragStartGeometry.top(), newWidth, height());
|
||||
saveWindowRegion();
|
||||
}
|
||||
break;
|
||||
|
||||
case Right:
|
||||
newWidth = mouse_event->globalX() - _dragStartGeometry.left();
|
||||
newWidth = x0 - _dragStartGeometry.left();
|
||||
if (newWidth > minimumWidth()){
|
||||
setGeometry(_dragStartGeometry.left(), _dragStartGeometry.top(), newWidth, height());
|
||||
saveWindowRegion();
|
||||
@@ -323,15 +330,15 @@ bool MainFrame::eventFilter(QObject *object, QEvent *event)
|
||||
break;
|
||||
|
||||
case Top:
|
||||
newHeight = _dragStartGeometry.bottom() - mouse_event->globalY();
|
||||
newHeight = _dragStartGeometry.bottom() - y0;
|
||||
if (newHeight > minimumHeight()){
|
||||
setGeometry(_dragStartGeometry.left(), mouse_event->globalY(),width(), newHeight);
|
||||
setGeometry(_dragStartGeometry.left(), y0,width(), newHeight);
|
||||
saveWindowRegion();
|
||||
}
|
||||
break;
|
||||
|
||||
case Bottom:
|
||||
newHeight = mouse_event->globalY() - _dragStartGeometry.top();
|
||||
newHeight = y0 - _dragStartGeometry.top();
|
||||
if (newHeight > minimumHeight()){
|
||||
setGeometry(_dragStartGeometry.left(), _dragStartGeometry.top(), width(), newHeight);
|
||||
saveWindowRegion();
|
||||
|
||||
14
DSView/pv/mainwindow.cpp
Executable file → Normal file
14
DSView/pv/mainwindow.cpp
Executable file → Normal file
@@ -39,6 +39,11 @@
|
||||
#include <QScreen>
|
||||
#include <QApplication>
|
||||
#include <QStandardPaths>
|
||||
#include <QScreen>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QGuiApplication>
|
||||
#endif
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
@@ -867,7 +872,14 @@ void MainWindow::on_screenShot()
|
||||
{
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
QString default_name = app._userHistory.screenShotPath + "/DSView" + QDateTime::currentDateTime().toString("-yyMMdd-hhmmss");
|
||||
QPixmap pixmap = QPixmap::grabWindow(winId());
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QScreen *scr = QGuiApplication::primaryScreen();
|
||||
QPixmap pixmap = scr->grabWindow(winId());
|
||||
#else
|
||||
QPixmap pixmap = QPixmap::grabWindow(winId());
|
||||
#endif
|
||||
|
||||
QString format = "png";
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QLocale>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QAbstractItemView>
|
||||
|
||||
#include "enum.h"
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
@@ -62,7 +62,7 @@ QWidget* Enum::get_widget(QWidget *parent, bool auto_commit)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_selector = new QComboBox(parent);
|
||||
_selector = new DsComboBox(parent);
|
||||
for (unsigned int i = 0; i < _values.size(); i++) {
|
||||
const pair<GVariant*, QString> &v = _values[i];
|
||||
_selector->addItem(v.second, QVariant::fromValue((void*)v.first));
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "property.h"
|
||||
|
||||
class QComboBox;
|
||||
class DsComboBox;
|
||||
|
||||
namespace pv {
|
||||
namespace prop {
|
||||
@@ -53,7 +53,7 @@ private slots:
|
||||
private:
|
||||
const std::vector< std::pair<GVariant*, QString> > _values;
|
||||
|
||||
QComboBox *_selector;
|
||||
DsComboBox *_selector;
|
||||
};
|
||||
|
||||
} // prop
|
||||
|
||||
@@ -79,9 +79,9 @@ SamplingBar::SamplingBar(SigSession *session, QWidget *parent) :
|
||||
|
||||
_mode_button.setPopupMode(QToolButton::InstantPopup);
|
||||
|
||||
_device_selector.setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
_sample_rate.setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
_sample_count.setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
_device_selector.setSizeAdjustPolicy(DsComboBox::AdjustToContents);
|
||||
_sample_rate.setSizeAdjustPolicy(DsComboBox::AdjustToContents);
|
||||
_sample_count.setSizeAdjustPolicy(DsComboBox::AdjustToContents);
|
||||
_device_selector.setMaximumWidth(ComboBoxMaxWidth);
|
||||
|
||||
//_run_stop_button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
struct st_dev_inst;
|
||||
class QAction;
|
||||
@@ -134,13 +134,13 @@ namespace pv
|
||||
bool _sampling;
|
||||
|
||||
QToolButton _device_type;
|
||||
QComboBox _device_selector;
|
||||
DsComboBox _device_selector;
|
||||
std::map<const void *, DevInst*> _device_selector_map;
|
||||
bool _updating_device_selector;
|
||||
|
||||
QToolButton _configure_button;
|
||||
QComboBox _sample_count;
|
||||
QComboBox _sample_rate;
|
||||
DsComboBox _sample_count;
|
||||
DsComboBox _sample_rate;
|
||||
bool _updating_sample_rate;
|
||||
bool _updating_sample_count;
|
||||
|
||||
|
||||
72
DSView/pv/ui/dscombobox.cpp
Normal file
72
DSView/pv/ui/dscombobox.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is part of the DSView project.
|
||||
* DSView is based on PulseView.
|
||||
*
|
||||
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
* Copyright (C) 2013 DreamSourceLab <support@dreamsourcelab.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "dscombobox.h"
|
||||
#include <QFontMetrics>
|
||||
#include <QString>
|
||||
#include "../config/appconfig.h"
|
||||
|
||||
DsComboBox::DsComboBox(QWidget *parent) : QComboBox(parent)
|
||||
{
|
||||
_contentWidth = 0;
|
||||
QComboBox::setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
}
|
||||
|
||||
void DsComboBox::addItem(const QString &atext, const QVariant &auserData)
|
||||
{
|
||||
QComboBox::addItem(atext, auserData);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
if (!atext.isEmpty()){
|
||||
QFontMetrics fm = this->fontMetrics();
|
||||
int w = fm.boundingRect(atext).width();
|
||||
if (w > _contentWidth){
|
||||
_contentWidth = w;
|
||||
this->setStyleSheet("QAbstractItemView{min-width:" + QString::number(w + 30) + "px;}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DsComboBox::showPopup()
|
||||
{
|
||||
QComboBox::showPopup();
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
|
||||
QWidget *popup = this->findChild<QFrame*>();
|
||||
auto rc = popup->geometry();
|
||||
int x = rc.left() + 6;
|
||||
int y = rc.top();
|
||||
int w = rc.right() - rc.left();
|
||||
int h = rc.bottom() - rc.top() + 15;
|
||||
popup->setGeometry(x, y, w, h);
|
||||
|
||||
if (AppConfig::Instance()._frameOptions.style == "dark"){
|
||||
popup->setStyleSheet("background-color:#262626;");
|
||||
}
|
||||
else{
|
||||
popup->setStyleSheet("background-color:#white;");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
46
DSView/pv/ui/dscombobox.h
Normal file
46
DSView/pv/ui/dscombobox.h
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* This file is part of the DSView project.
|
||||
* DSView is based on PulseView.
|
||||
*
|
||||
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
* Copyright (C) 2013 DreamSourceLab <support@dreamsourcelab.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DSCOMBOBOX_H
|
||||
#define DSCOMBOBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
class DsComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DsComboBox(QWidget *parent = nullptr);
|
||||
|
||||
void addItem(const QString &atext, const QVariant &userData = QVariant());
|
||||
|
||||
protected:
|
||||
void showPopup();
|
||||
|
||||
private:
|
||||
int _contentWidth;
|
||||
};
|
||||
|
||||
#endif // DSCOMBOBOX_H
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include <QAction>
|
||||
#include <QComboBox>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
@@ -53,6 +52,7 @@
|
||||
#include "../view/cursor.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
#include "../dsvdef.h"
|
||||
#include "../ui/dscombobox.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
@@ -418,8 +418,8 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form)
|
||||
}
|
||||
|
||||
//Add region combobox
|
||||
_start_comboBox = new QComboBox(parent);
|
||||
_end_comboBox = new QComboBox(parent);
|
||||
_start_comboBox = new DsComboBox(parent);
|
||||
_end_comboBox = new DsComboBox(parent);
|
||||
_start_comboBox->addItem(RegionStart);
|
||||
_end_comboBox->addItem(RegionEnd);
|
||||
|
||||
@@ -726,7 +726,7 @@ void DecodeTrace::create_decoder_form(
|
||||
for(l = decoder->channels; l; l = l->next) {
|
||||
const struct srd_channel *const pdch =
|
||||
(struct srd_channel *)l->data;
|
||||
QComboBox *const combo = create_probe_selector(parent, dec, pdch);
|
||||
DsComboBox *const combo = create_probe_selector(parent, dec, pdch);
|
||||
|
||||
decoder_form->addRow(tr("<b>%1</b> (%2) *")
|
||||
.arg(QString::fromUtf8(pdch->name))
|
||||
@@ -742,7 +742,7 @@ void DecodeTrace::create_decoder_form(
|
||||
for(l = decoder->opt_channels; l; l = l->next) {
|
||||
const struct srd_channel *const pdch =
|
||||
(struct srd_channel *)l->data;
|
||||
QComboBox *const combo = create_probe_selector(parent, dec, pdch);
|
||||
DsComboBox *const combo = create_probe_selector(parent, dec, pdch);
|
||||
|
||||
decoder_form->addRow(tr("<b>%1</b> (%2)")
|
||||
.arg(QString::fromUtf8(pdch->name))
|
||||
@@ -770,7 +770,7 @@ void DecodeTrace::create_decoder_form(
|
||||
connect(group, SIGNAL(del_stack(data::decode::Decoder*)), this, SLOT(on_del_stack(data::decode::Decoder*)));
|
||||
}
|
||||
|
||||
QComboBox* DecodeTrace::create_probe_selector(
|
||||
DsComboBox* DecodeTrace::create_probe_selector(
|
||||
QWidget *parent, const data::decode::Decoder *dec,
|
||||
const srd_channel *const pdch)
|
||||
{
|
||||
@@ -783,7 +783,7 @@ QComboBox* DecodeTrace::create_probe_selector(
|
||||
data::decode::Decoder *_dec = const_cast<data::decode::Decoder*>(dec);
|
||||
|
||||
auto probe_iter = _dec->channels().find(pdch);
|
||||
QComboBox *selector = new QComboBox(parent);
|
||||
DsComboBox *selector = new DsComboBox(parent);
|
||||
|
||||
selector->addItem("-", QVariant::fromValue(-1));
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
struct srd_channel;
|
||||
struct srd_decoder;
|
||||
|
||||
class QComboBox;
|
||||
class DsComboBox;
|
||||
|
||||
namespace pv {
|
||||
|
||||
@@ -66,7 +66,7 @@ class DecodeTrace : public Trace
|
||||
private:
|
||||
struct ProbeSelector
|
||||
{
|
||||
const QComboBox *_combo;
|
||||
const DsComboBox *_combo;
|
||||
const pv::data::decode::Decoder *_decoder;
|
||||
const srd_channel *_pdch;
|
||||
};
|
||||
@@ -180,7 +180,7 @@ private:
|
||||
pv::data::decode::Decoder *dec,
|
||||
QWidget *parent, QFormLayout *form);
|
||||
|
||||
QComboBox* create_probe_selector(QWidget *parent,
|
||||
DsComboBox* create_probe_selector(QWidget *parent,
|
||||
const pv::data::decode::Decoder *dec,
|
||||
const srd_channel *const pdch);
|
||||
|
||||
@@ -219,8 +219,8 @@ private:
|
||||
int _start_count;
|
||||
int _end_count;
|
||||
|
||||
QComboBox *_start_comboBox;
|
||||
QComboBox *_end_comboBox;
|
||||
DsComboBox *_start_comboBox;
|
||||
DsComboBox *_end_comboBox;
|
||||
QFormLayout *_pub_input_layer;
|
||||
int _progress;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <math.h>
|
||||
#include <QTextStream>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "spectrumtrace.h"
|
||||
#include "../sigsession.h"
|
||||
@@ -208,12 +209,17 @@ QString SpectrumTrace::format_freq(double freq, unsigned precision)
|
||||
const int prefix = floor((order - FirstSIPrefixPower)/ 3.0f);
|
||||
const double divider = pow(10.0, max(prefix * 3.0 + FirstSIPrefixPower, 0.0));
|
||||
|
||||
QString s;
|
||||
QTextStream ts(&s);
|
||||
ts.setRealNumberPrecision(precision);
|
||||
ts << fixed << freq / divider <<
|
||||
FreqPrefixes[prefix] << "Hz";
|
||||
return s;
|
||||
//QString s;
|
||||
//QTextStream ts(&s);
|
||||
//ts.setRealNumberPrecision(precision);
|
||||
//ts << fixed << freq / divider << FreqPrefixes[prefix] << "Hz";
|
||||
//return s;
|
||||
char buf[20] = {0};
|
||||
char format[10] = {0};
|
||||
sprintf(format, "%%.%df%%s", precision);
|
||||
QString prev = FreqPrefixes[prefix] + "Hz";
|
||||
sprintf(buf, format, freq / divider, prev.toLatin1().data());
|
||||
return QString(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1597,7 +1597,9 @@ void Viewport::paintMeasure(QPainter &p, QColor fore, QColor back)
|
||||
QString delta_text = _view.get_index_delta(_edge_start, _edge_end) +
|
||||
"/" + QString::number(delta);
|
||||
QFontMetrics fm = this->fontMetrics();
|
||||
const int rectW = fm.width(delta_text) + 60;
|
||||
// const int rectW = fm.width(delta_text) + 60;
|
||||
const int rectW = fm.boundingRect(delta_text).width() + 60;
|
||||
|
||||
const int rectH = fm.height() + 10;
|
||||
//const int rectY = (_cur_aftY >= _cur_preY) ? _cur_preY_top : _cur_preY_bottom;
|
||||
//const int rectX = (_cur_aftX >= _cur_preX) ? _cur_preX : _cur_preX - rectW;
|
||||
|
||||
@@ -54,7 +54,12 @@ ViewStatus::ViewStatus(SigSession *session, View &parent) :
|
||||
void ViewStatus::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
opt.initFrom(this);
|
||||
#else
|
||||
opt.init(this);
|
||||
#endif
|
||||
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
|
||||
|
||||
192
libsigrok4DSL/config.h
Normal file
192
libsigrok4DSL/config.h
Normal file
@@ -0,0 +1,192 @@
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
#ifndef SR_CONFIG_H
|
||||
#define SR_CONFIG_H /* To stop multiple inclusions. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* DreamSourceLab hardware driver support */
|
||||
#define HAVE_DSL_DEVICE 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Demo driver support */
|
||||
#define HAVE_LA_DEMO 1
|
||||
|
||||
/* Specifies whether we have libserialport. */
|
||||
/* #undef HAVE_LIBSERIALPORT */
|
||||
|
||||
/* Specifies whether we have a libusb.h header. */
|
||||
#define HAVE_LIBUSB_1_0 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#define HAVE_MEMSET 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `strchr' function. */
|
||||
#define HAVE_STRCHR 1
|
||||
|
||||
/* Define to 1 if you have the `strcspn' function. */
|
||||
#define HAVE_STRCSPN 1
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strncasecmp' function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the `strstr' function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define to 1 if you have the `strtol' function. */
|
||||
#define HAVE_STRTOL 1
|
||||
|
||||
/* Define to 1 if you have the `strtoul' function. */
|
||||
#define HAVE_STRTOUL 1
|
||||
|
||||
/* Define to 1 if you have the `strtoull' function. */
|
||||
#define HAVE_STRTOULL 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
#define HAVE_TERMIOS_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libsigrok4DSL"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "support@dreamsourcelab.com"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "libsigrok4DSL"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libsigrok4DSL 0.2.0"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libsigrok4DSL"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL "http://www.dreamsourcelab.com"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "0.2.0"
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.2.0"
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
/* # undef WORDS_BIGENDIAN */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
|
||||
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
||||
#define below would cause a syntax error. */
|
||||
/* #undef _UINT32_T */
|
||||
|
||||
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
|
||||
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
||||
#define below would cause a syntax error. */
|
||||
/* #undef _UINT64_T */
|
||||
|
||||
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
|
||||
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
||||
#define below would cause a syntax error. */
|
||||
/* #undef _UINT8_T */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
/* #undef inline */
|
||||
#endif
|
||||
|
||||
/* Define to the type of a signed integer type of width exactly 16 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
/* #undef int16_t */
|
||||
|
||||
/* Define to the type of a signed integer type of width exactly 32 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
/* #undef int32_t */
|
||||
|
||||
/* Define to the type of a signed integer type of width exactly 64 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
/* #undef int64_t */
|
||||
|
||||
/* Define to the type of a signed integer type of width exactly 8 bits if such
|
||||
a type exists and the standard includes do not define it. */
|
||||
/* #undef int8_t */
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 16 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
/* #undef uint16_t */
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 32 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
/* #undef uint32_t */
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 64 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
/* #undef uint64_t */
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 8 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
/* #undef uint8_t */
|
||||
|
||||
#endif /* SR_CONFIG_H */
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <glib.h>
|
||||
#include "config.h" /* Needed for PACKAGE_STRING and others. */
|
||||
#include "../config.h" /* Needed for PACKAGE_STRING and others. */
|
||||
|
||||
#define LOG_PREFIX "output/gnuplot"
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ SOURCES += \
|
||||
../DSView/pv/ZipMaker.cpp \
|
||||
../DSView/pv/data/decode/AnnotationResTable.cpp \
|
||||
../DSView/pv/ui/msgbox.cpp \
|
||||
../DSView/pv/ui/dscombobox.cpp \
|
||||
../DSView/pv/dock/protocolitemlayer.cpp \
|
||||
../DSView/pv/config/appconfig.cpp \
|
||||
../DSView/pv/dsvdef.cpp \
|
||||
@@ -262,6 +263,7 @@ HEADERS += \
|
||||
../DSView/pv/ZipMaker.h \
|
||||
../DSView/pv/data/decode/AnnotationResTable.h \
|
||||
../DSView/pv/ui/msgbox.h \
|
||||
../DSView/pv/ui/dscombobox.h \
|
||||
../DSView/pv/dock/protocolitemlayer.h \
|
||||
../DSView/pv/config/appconfig.h \
|
||||
../DSView/pv/dsvdef.h \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.11.0, 2021-11-19T11:46:54. -->
|
||||
<!-- Written by QtCreator 4.11.0, 2021-11-22T18:49:27. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
Reference in New Issue
Block a user