forked from Ivasoft/DSView
zip marker
This commit is contained in:
@@ -161,16 +161,17 @@ int main(int argc, char *argv[])
|
||||
dir.cd("share") &&
|
||||
dir.cd(QApplication::applicationName()) &&
|
||||
dir.cd("res")) {
|
||||
// the path command like: cd ../share/DSView/res
|
||||
QString res_dir = dir.absolutePath() + "/";
|
||||
strcpy(DS_RES_PATH, res_dir.toUtf8().data());
|
||||
} else {
|
||||
qDebug() << "ERROR: config files don't exist.";
|
||||
qDebug() << "DSView run ERROR: config files don't exist.";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Initialise libsigrok
|
||||
if (sr_init(&sr_ctx) != SR_OK) {
|
||||
qDebug() << "ERROR: libsigrok init failed.";
|
||||
qDebug() << "DSView run ERROR: libsigrok init failed.";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -194,7 +195,7 @@ int main(int argc, char *argv[])
|
||||
pv::MainFrame w(device_manager, open_file);
|
||||
w.show();
|
||||
w.readSettings();
|
||||
w.show_doc();
|
||||
w.show_doc(); // to show the dailog for open help document
|
||||
|
||||
// Run the application
|
||||
ret = a.exec();
|
||||
|
||||
@@ -105,7 +105,7 @@ std::list<boost::shared_ptr<device::DevInst> > DeviceManager::driver_scan(
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear all the old device instances from this driver
|
||||
sr_dev_clear(driver);
|
||||
|
||||
@@ -69,7 +69,7 @@ void StoreProgress::timeout()
|
||||
if (_done) {
|
||||
_store_session.session().set_saving(false);
|
||||
save_done();
|
||||
close();
|
||||
close();
|
||||
} else {
|
||||
QTimer::singleShot(100, this, SLOT(timeout()));
|
||||
}
|
||||
|
||||
@@ -77,11 +77,10 @@ MainFrame::MainFrame(DeviceManager &device_manager,
|
||||
// Title
|
||||
_titleBar = new toolbars::TitleBar(true, this);
|
||||
_titleBar->installEventFilter(this);
|
||||
|
||||
|
||||
// MainWindow
|
||||
_mainWindow = new MainWindow(device_manager, open_file_name, this);
|
||||
_mainWindow->setWindowFlags(Qt::Widget);
|
||||
|
||||
_titleBar->setTitle(_mainWindow->windowTitle());
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout();
|
||||
@@ -185,7 +184,7 @@ void MainFrame::hide_border()
|
||||
}
|
||||
|
||||
void MainFrame::show_border()
|
||||
{
|
||||
{
|
||||
_top_left->setVisible(true);
|
||||
_top_right->setVisible(true);
|
||||
_top->setVisible(true);
|
||||
|
||||
@@ -870,6 +870,7 @@ void MainWindow::on_screenShot()
|
||||
}
|
||||
}
|
||||
|
||||
//save file
|
||||
void MainWindow::on_save()
|
||||
{
|
||||
using pv::dialogs::StoreProgress;
|
||||
@@ -1227,7 +1228,7 @@ bool MainWindow::store_session(QString name)
|
||||
QJsonDocument sessionDoc(sessionVar);
|
||||
//sessionFile.write(QString::fromUtf8(sessionDoc.toJson()));
|
||||
outStream << QString::fromUtf8(sessionDoc.toJson());
|
||||
sessionFile.close();
|
||||
sessionFile.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ namespace view {
|
||||
class View;
|
||||
}
|
||||
|
||||
//The mainwindow,referenced by MainFrame
|
||||
//TODO: create graph view,toolbar,and show device list
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -186,7 +188,7 @@ private:
|
||||
toolbars::SamplingBar *_sampling_bar;
|
||||
toolbars::TrigBar *_trig_bar;
|
||||
toolbars::FileBar *_file_bar;
|
||||
toolbars::LogoBar *_logo_bar;
|
||||
toolbars::LogoBar *_logo_bar; //help button, on top right
|
||||
|
||||
#ifdef ENABLE_DECODE
|
||||
QDockWidget *_protocol_dock;
|
||||
|
||||
@@ -156,6 +156,9 @@ boost::shared_ptr<device::DevInst> SigSession::get_device() const
|
||||
return _dev_inst;
|
||||
}
|
||||
|
||||
/*
|
||||
when be called, it will call 4DSL lib sr_session_new, and create a session struct in the lib
|
||||
*/
|
||||
void SigSession::set_device(boost::shared_ptr<device::DevInst> dev_inst)
|
||||
{
|
||||
using pv::device::Device;
|
||||
@@ -746,8 +749,8 @@ void SigSession::init_signals()
|
||||
switch(probe->type) {
|
||||
case SR_CHANNEL_LOGIC:
|
||||
if (probe->enabled)
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::LogicSignal(_dev_inst, _logic_data, probe));
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::LogicSignal(_dev_inst, _logic_data, probe));
|
||||
break;
|
||||
|
||||
case SR_CHANNEL_DSO:
|
||||
@@ -803,7 +806,7 @@ void SigSession::reload()
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(*i)))
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::LogicSignal(logicSig, _logic_data, probe));
|
||||
new view::LogicSignal(logicSig, _logic_data, probe));
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
||||
@@ -92,6 +92,7 @@ class Decoder;
|
||||
class DecoderFactory;
|
||||
}
|
||||
|
||||
//created by MainWindow
|
||||
class SigSession : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -291,8 +292,10 @@ private:
|
||||
void feed_in_logic(const sr_datafeed_logic &logic);
|
||||
void feed_in_dso(const sr_datafeed_dso &dso);
|
||||
void feed_in_analog(const sr_datafeed_analog &analog);
|
||||
|
||||
void data_feed_in(const struct sr_dev_inst *sdi,
|
||||
const struct sr_datafeed_packet *packet);
|
||||
|
||||
static void data_feed_in_proc(const struct sr_dev_inst *sdi,
|
||||
const struct sr_datafeed_packet *packet, void *cb_data);
|
||||
|
||||
|
||||
@@ -60,6 +60,20 @@ using std::vector;
|
||||
|
||||
namespace pv {
|
||||
|
||||
char chunk_name[30] = {0};
|
||||
|
||||
void MakeChunkName(int chunk_num, int index, int type, int version){
|
||||
if (version == 2) {
|
||||
const char *type_name = NULL;
|
||||
type_name = (type == SR_CHANNEL_LOGIC) ? "L" :
|
||||
(type == SR_CHANNEL_DSO) ? "O" :
|
||||
(type == SR_CHANNEL_ANALOG) ? "A" : "U";
|
||||
snprintf(chunk_name, 15, "%s-%d/%d", type_name, index, chunk_num);
|
||||
} else {
|
||||
snprintf(chunk_name, 15, "data");
|
||||
}
|
||||
}
|
||||
|
||||
StoreSession::StoreSession(SigSession &session) :
|
||||
_session(session),
|
||||
_outModule(NULL),
|
||||
@@ -179,6 +193,8 @@ bool StoreSession::save_start(QString session_file)
|
||||
#else
|
||||
QString decoders_file = NULL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (meta_file == NULL) {
|
||||
_error = tr("Generate temp file failed.");
|
||||
} else {
|
||||
@@ -193,6 +209,23 @@ bool StoreSession::save_start(QString session_file)
|
||||
return !_has_error;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//make zip file
|
||||
if (meta_file != NULL && m_zipDoc.CreateNew())
|
||||
{
|
||||
if ( !m_zipDoc.AddFromFile(meta_file.toUtf8().data(), "header")
|
||||
|| !m_zipDoc.AddFromFile(decoders_file.toUtf8().data(), "decoders")
|
||||
|| !m_zipDoc.AddFromFile(session_file.toUtf8().data(), "session"))
|
||||
{
|
||||
_has_error = true;
|
||||
_error = m_zipDoc.GetError();
|
||||
}
|
||||
else{
|
||||
_thread = boost::thread(&StoreSession::save_proc, this, snapshot);
|
||||
return !_has_error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QFile::remove(_file_name);
|
||||
@@ -239,8 +272,13 @@ void StoreSession::save_proc(shared_ptr<data::Snapshot> snapshot)
|
||||
memset(buf, sample ? 0xff : 0x0, size);
|
||||
}
|
||||
}
|
||||
ret = sr_session_append(_file_name.toUtf8().data(), buf, size,
|
||||
i, ch_index, ch_type, File_Version);
|
||||
|
||||
// ret = sr_session_append(_file_name.toUtf8().data(), buf, size,
|
||||
// i, ch_index, ch_type, File_Version);
|
||||
|
||||
MakeChunkName(i, ch_index, ch_type, File_Version);
|
||||
ret = m_zipDoc.AddFromBuffer(chunk_name, (const char*)buf, size) ? SR_OK : -1;
|
||||
|
||||
if (ret != SR_OK) {
|
||||
if (!_has_error) {
|
||||
_has_error = true;
|
||||
@@ -285,19 +323,30 @@ void StoreSession::save_proc(shared_ptr<data::Snapshot> snapshot)
|
||||
memcpy(tmp, buf, buf_end-buf);
|
||||
memcpy(tmp+(buf_end-buf), buf_start, buf+size-buf_end);
|
||||
}
|
||||
ret = sr_session_append(_file_name.toUtf8().data(), tmp, size,
|
||||
i, 0, ch_type, File_Version);
|
||||
|
||||
ret = sr_session_append(_file_name.toUtf8().data(), tmp, size,
|
||||
i, 0, ch_type, File_Version);
|
||||
|
||||
MakeChunkName(i, 0, ch_type, File_Version);
|
||||
ret = m_zipDoc.AddFromBuffer(chunk_name, (const char*)tmp, size) ? SR_OK : -1;
|
||||
|
||||
buf += (size - _unit_count);
|
||||
if (tmp)
|
||||
free(tmp);
|
||||
} else {
|
||||
ret = sr_session_append(_file_name.toUtf8().data(), buf, size,
|
||||
i, 0, ch_type, File_Version);
|
||||
|
||||
// ret = sr_session_append(_file_name.toUtf8().data(), buf, size,
|
||||
// i, 0, ch_type, File_Version);
|
||||
|
||||
MakeChunkName(i, 0, ch_type, File_Version);
|
||||
ret = m_zipDoc.AddFromBuffer(chunk_name, (const char*)buf, size) ? SR_OK : -1;
|
||||
|
||||
buf += size;
|
||||
}
|
||||
if (ret != SR_OK) {
|
||||
if (!_has_error) {
|
||||
_has_error = true;
|
||||
auto err = m_zipDoc.GetError();
|
||||
_error = tr("Failed to create zip file. Please check write permission of this path.");
|
||||
}
|
||||
progress_updated();
|
||||
@@ -314,6 +363,15 @@ void StoreSession::save_proc(shared_ptr<data::Snapshot> snapshot)
|
||||
|
||||
if (_canceled || num == 0)
|
||||
QFile::remove(_file_name);
|
||||
else {
|
||||
bool bret = m_zipDoc.SaveToFile(_file_name.toUtf8().data());
|
||||
m_zipDoc.Release();
|
||||
|
||||
if (!bret){
|
||||
_has_error = true;
|
||||
_error = m_zipDoc.GetError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <libsigrok4DSL/libsigrok.h>
|
||||
#include <libsigrokdecode4DSL/libsigrokdecode.h>
|
||||
#include "ZipMaker.h"
|
||||
|
||||
namespace pv {
|
||||
|
||||
@@ -106,6 +107,7 @@ private:
|
||||
bool _has_error;
|
||||
QString _error;
|
||||
bool _canceled;
|
||||
ZipMaker m_zipDoc;
|
||||
};
|
||||
|
||||
} // pv
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
namespace pv {
|
||||
namespace toolbars {
|
||||
|
||||
//toolbar button,referenced by MainWindow
|
||||
//TODO: load session file, sorte session, load log data file, sorte data, export data
|
||||
class FileBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -55,12 +57,12 @@ private:
|
||||
const QString text, const QString info_text);
|
||||
|
||||
signals:
|
||||
void load_file(QString);
|
||||
void load_file(QString);
|
||||
void on_save();
|
||||
void on_export();
|
||||
void on_screenShot();
|
||||
void load_session(QString);
|
||||
void store_session(QString);
|
||||
void on_screenShot(); //post screen capture event message
|
||||
void load_session(QString); //post load session event message
|
||||
void store_session(QString); //post store session event message
|
||||
|
||||
private slots:
|
||||
void on_actionLoad_triggered();
|
||||
@@ -77,7 +79,7 @@ private:
|
||||
|
||||
QMenu *_menu;
|
||||
|
||||
QMenu *_menu_session;
|
||||
QMenu *_menu_session; //when the hardware device is connected,it will be enable
|
||||
QAction *_action_load;
|
||||
QAction *_action_store;
|
||||
QAction *_action_default;
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
namespace pv {
|
||||
namespace toolbars {
|
||||
|
||||
//The tool button for help,is a ui class,referenced by MainWindow
|
||||
//TODO: switch language,submit bug descript,
|
||||
class LogoBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -44,6 +46,7 @@ public:
|
||||
|
||||
void enable_toggle(bool enable);
|
||||
|
||||
//show the hardware device conneted status with logo picture
|
||||
void dsl_connected(bool conn);
|
||||
|
||||
private:
|
||||
@@ -57,8 +60,11 @@ private:
|
||||
const QString text, const QString info_text);
|
||||
|
||||
signals:
|
||||
void setLanguage(int language);
|
||||
void openDoc();
|
||||
//post event message to set language, MainWindow class receive it
|
||||
void setLanguage(int language);
|
||||
|
||||
//post event message to open user help document, MainWindow class receive it
|
||||
void openDoc();
|
||||
|
||||
private slots:
|
||||
void on_actionEn_triggered();
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DSVIEW_PV_TOOLBARS_SAMPLINGBAR_H
|
||||
#define DSVIEW_PV_TOOLBARS_SAMPLINGBAR_H
|
||||
|
||||
@@ -40,134 +39,137 @@
|
||||
struct st_dev_inst;
|
||||
class QAction;
|
||||
|
||||
namespace pv {
|
||||
namespace pv
|
||||
{
|
||||
class SigSession;
|
||||
|
||||
class SigSession;
|
||||
namespace device
|
||||
{
|
||||
// class DevInst;
|
||||
}
|
||||
|
||||
namespace device {
|
||||
class DevInst;
|
||||
}
|
||||
namespace dialogs
|
||||
{
|
||||
class deviceoptions;
|
||||
class Calibration;
|
||||
}
|
||||
|
||||
namespace dialogs {
|
||||
class deviceoptions;
|
||||
class Calibration;
|
||||
}
|
||||
namespace toolbars
|
||||
{
|
||||
|
||||
namespace toolbars {
|
||||
class SamplingBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class SamplingBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
static const int ComboBoxMaxWidth = 200;
|
||||
static const int RefreshShort = 500;
|
||||
static const uint64_t LogicMaxSWDepth64 = SR_GB(16);
|
||||
static const uint64_t LogicMaxSWDepth32 = SR_GB(8);
|
||||
static const uint64_t AnalogMaxSWDepth = SR_Mn(100);
|
||||
static const QString RLEString;
|
||||
static const QString DIVString;
|
||||
static const uint64_t ZeroTimeBase = SR_US(2);
|
||||
|
||||
private:
|
||||
static const int ComboBoxMaxWidth = 200;
|
||||
static const int RefreshShort = 500;
|
||||
static const uint64_t LogicMaxSWDepth64 = SR_GB(16);
|
||||
static const uint64_t LogicMaxSWDepth32 = SR_GB(8);
|
||||
static const uint64_t AnalogMaxSWDepth = SR_Mn(100);
|
||||
static const QString RLEString;
|
||||
static const QString DIVString;
|
||||
static const uint64_t ZeroTimeBase = SR_US(2);
|
||||
public:
|
||||
SamplingBar(SigSession &session, QWidget *parent);
|
||||
|
||||
public:
|
||||
SamplingBar(SigSession &session, QWidget *parent);
|
||||
void set_device_list(const std::list<boost::shared_ptr<pv::device::DevInst>> &devices,
|
||||
boost::shared_ptr<pv::device::DevInst> selected);
|
||||
|
||||
void set_device_list(const std::list< boost::shared_ptr<pv::device::DevInst> > &devices,
|
||||
boost::shared_ptr<pv::device::DevInst> selected);
|
||||
boost::shared_ptr<pv::device::DevInst> get_selected_device() const;
|
||||
|
||||
boost::shared_ptr<pv::device::DevInst> get_selected_device() const;
|
||||
void update_sample_rate_selector();
|
||||
|
||||
void update_sample_rate_selector();
|
||||
void set_sampling(bool sampling);
|
||||
bool get_sampling() const;
|
||||
bool get_instant() const;
|
||||
|
||||
void set_sampling(bool sampling);
|
||||
bool get_sampling() const;
|
||||
bool get_instant() const;
|
||||
void enable_toggle(bool enable);
|
||||
|
||||
void enable_toggle(bool enable);
|
||||
void enable_run_stop(bool enable);
|
||||
|
||||
void enable_run_stop(bool enable);
|
||||
void enable_instant(bool enable);
|
||||
|
||||
void enable_instant(bool enable);
|
||||
double hori_knob(int dir);
|
||||
double commit_hori_res();
|
||||
double get_hori_res();
|
||||
|
||||
double hori_knob(int dir);
|
||||
double commit_hori_res();
|
||||
double get_hori_res();
|
||||
public slots:
|
||||
void set_sample_rate(uint64_t sample_rate);
|
||||
|
||||
public slots:
|
||||
void set_sample_rate(uint64_t sample_rate);
|
||||
signals:
|
||||
void run_stop();
|
||||
void instant_stop();
|
||||
void device_selected();
|
||||
void device_updated();
|
||||
void duration_changed();
|
||||
void show_calibration();
|
||||
void hide_calibration();
|
||||
|
||||
signals:
|
||||
void run_stop();
|
||||
void instant_stop();
|
||||
void device_selected();
|
||||
void device_updated();
|
||||
void duration_changed();
|
||||
void show_calibration();
|
||||
void hide_calibration();
|
||||
private:
|
||||
void changeEvent(QEvent *event);
|
||||
void retranslateUi();
|
||||
void reStyle();
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent *event);
|
||||
void retranslateUi();
|
||||
void reStyle();
|
||||
void update_sample_rate_selector_value();
|
||||
void update_sample_count_selector();
|
||||
void update_sample_count_selector_value();
|
||||
void commit_settings();
|
||||
void setting_adj();
|
||||
|
||||
void update_sample_rate_selector_value();
|
||||
void update_sample_count_selector();
|
||||
void update_sample_count_selector_value();
|
||||
void commit_settings();
|
||||
void setting_adj();
|
||||
private slots:
|
||||
void on_mode();
|
||||
void on_run_stop();
|
||||
void on_instant_stop();
|
||||
void on_device_selected();
|
||||
void on_samplerate_sel(int index);
|
||||
void on_samplecount_sel(int index);
|
||||
|
||||
private slots:
|
||||
void on_mode();
|
||||
void on_run_stop();
|
||||
void on_instant_stop();
|
||||
void on_device_selected();
|
||||
void on_samplerate_sel(int index);
|
||||
void on_samplecount_sel(int index);
|
||||
void show_session_error(
|
||||
const QString text, const QString info_text);
|
||||
|
||||
void show_session_error(
|
||||
const QString text, const QString info_text);
|
||||
public slots:
|
||||
void on_configure();
|
||||
void zero_adj();
|
||||
void reload();
|
||||
|
||||
public slots:
|
||||
void on_configure();
|
||||
void zero_adj();
|
||||
void reload();
|
||||
private:
|
||||
SigSession &_session;
|
||||
|
||||
private:
|
||||
SigSession &_session;
|
||||
mutable boost::recursive_mutex _sampling_mutex;
|
||||
bool _enable;
|
||||
bool _sampling;
|
||||
|
||||
mutable boost::recursive_mutex _sampling_mutex;
|
||||
bool _enable;
|
||||
bool _sampling;
|
||||
QToolButton _device_type;
|
||||
|
||||
QToolButton _device_type;
|
||||
QComboBox _device_selector;
|
||||
std::map<const void *, boost::weak_ptr<device::DevInst>>
|
||||
_device_selector_map;
|
||||
bool _updating_device_selector;
|
||||
|
||||
QComboBox _device_selector;
|
||||
std::map<const void*, boost::weak_ptr<device::DevInst> >
|
||||
_device_selector_map;
|
||||
bool _updating_device_selector;
|
||||
QToolButton _configure_button;
|
||||
|
||||
QToolButton _configure_button;
|
||||
QComboBox _sample_count;
|
||||
QComboBox _sample_rate;
|
||||
bool _updating_sample_rate;
|
||||
bool _updating_sample_count;
|
||||
|
||||
QComboBox _sample_count;
|
||||
QComboBox _sample_rate;
|
||||
bool _updating_sample_rate;
|
||||
bool _updating_sample_count;
|
||||
QToolButton _run_stop_button;
|
||||
QToolButton _instant_button;
|
||||
QAction *_run_stop_action;
|
||||
QAction *_instant_action;
|
||||
|
||||
QToolButton _run_stop_button;
|
||||
QToolButton _instant_button;
|
||||
QAction* _run_stop_action;
|
||||
QAction* _instant_action;
|
||||
QAction *_mode_action;
|
||||
QToolButton _mode_button;
|
||||
QMenu *_mode_menu;
|
||||
QAction *_action_repeat;
|
||||
QAction *_action_single;
|
||||
|
||||
QAction* _mode_action;
|
||||
QToolButton _mode_button;
|
||||
QMenu *_mode_menu;
|
||||
QAction *_action_repeat;
|
||||
QAction *_action_single;
|
||||
bool _instant;
|
||||
};
|
||||
|
||||
bool _instant;
|
||||
};
|
||||
|
||||
} // namespace toolbars
|
||||
} // namespace toolbars
|
||||
} // namespace pv
|
||||
|
||||
#endif // DSVIEW_PV_TOOLBARS_SAMPLINGBAR_H
|
||||
|
||||
@@ -101,7 +101,7 @@ void TitleBar::reStyle()
|
||||
}
|
||||
|
||||
void TitleBar::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
{
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter p(this);
|
||||
@@ -109,6 +109,7 @@ void TitleBar::paintEvent(QPaintEvent *event)
|
||||
|
||||
p.setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
//To draw product logo
|
||||
const int xgap = 2;
|
||||
const int xstart = 10;
|
||||
p.setPen(QPen(QColor(213, 15, 37, 255), 2, Qt::SolidLine));
|
||||
|
||||
@@ -26,50 +26,55 @@
|
||||
class QLabel;
|
||||
class QToolButton;
|
||||
|
||||
namespace pv {
|
||||
namespace toolbars {
|
||||
|
||||
class TitleBar : public QWidget
|
||||
namespace pv
|
||||
{
|
||||
Q_OBJECT
|
||||
namespace toolbars
|
||||
{
|
||||
|
||||
public:
|
||||
TitleBar(bool top, QWidget *parent, bool hasClose = false);
|
||||
void setTitle(QString title);
|
||||
QPoint get_startPos() const;
|
||||
QString title() const;
|
||||
//Window's titlebar, referenced by MainFrame,
|
||||
//The title area above the main screen,
|
||||
//Display logo and maximize \ minimize button
|
||||
class TitleBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent *event);
|
||||
void reStyle();
|
||||
public:
|
||||
TitleBar(bool top, QWidget *parent, bool hasClose = false);
|
||||
void setTitle(QString title);
|
||||
QPoint get_startPos() const;
|
||||
QString title() const;
|
||||
|
||||
signals:
|
||||
void normalShow();
|
||||
void maximizedShow();
|
||||
private:
|
||||
void changeEvent(QEvent *event);
|
||||
void reStyle();
|
||||
|
||||
public slots:
|
||||
void showMaxRestore();
|
||||
void setRestoreButton(bool max);
|
||||
signals:
|
||||
void normalShow();
|
||||
void maximizedShow();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
public slots:
|
||||
void showMaxRestore();
|
||||
void setRestoreButton(bool max);
|
||||
|
||||
QLabel *_title;
|
||||
QToolButton *_minimizeButton;
|
||||
QToolButton *_maximizeButton;
|
||||
QToolButton *_closeButton;
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
|
||||
bool _moving;
|
||||
bool _isTop;
|
||||
bool _hasClose;
|
||||
QPoint _startPos;
|
||||
};
|
||||
QLabel *_title;
|
||||
QToolButton *_minimizeButton;
|
||||
QToolButton *_maximizeButton;
|
||||
QToolButton *_closeButton;
|
||||
|
||||
} // namespace toolbars
|
||||
bool _moving;
|
||||
bool _isTop;
|
||||
bool _hasClose;
|
||||
QPoint _startPos;
|
||||
};
|
||||
|
||||
} // namespace toolbars
|
||||
} // namespace pv
|
||||
|
||||
#endif // DSVIEW_PV_TOOLBARS_TITLEBAR_H
|
||||
|
||||
@@ -34,6 +34,8 @@ class SigSession;
|
||||
|
||||
namespace toolbars {
|
||||
|
||||
//boolbar, referenced by MainWindow
|
||||
//TODO:show the property panel about protocol\trigger
|
||||
class TrigBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -57,9 +59,9 @@ private:
|
||||
|
||||
signals:
|
||||
void setTheme(QString style);
|
||||
void on_protocol(bool visible);
|
||||
void on_trigger(bool visible);
|
||||
void on_measure(bool visible);
|
||||
void on_protocol(bool visible); //post decode button click event,to show or hide protocol property panel
|
||||
void on_trigger(bool visible); //post decode button click event,to show or hide trigger property panel
|
||||
void on_measure(bool visible);//post decode button click event,to show or hide measure property panel
|
||||
void on_search(bool visible);
|
||||
void show_lissajous(bool visible);
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ class AnalogSnapshot;
|
||||
|
||||
namespace view {
|
||||
|
||||
//when device is data acquisition model, to draw trace
|
||||
//created by SigSession
|
||||
class AnalogSignal : public Signal
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -33,6 +33,7 @@ class QPainter;
|
||||
namespace pv {
|
||||
namespace view {
|
||||
|
||||
//created by View
|
||||
class Cursor : public TimeMarker
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -48,7 +48,7 @@ dslDial::~dslDial()
|
||||
}
|
||||
|
||||
void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor, const QPoint pt, QString &pText)
|
||||
{
|
||||
{
|
||||
p.setPen(dialColor);
|
||||
p.setBrush(dialColor);
|
||||
|
||||
@@ -108,6 +108,8 @@ void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor, const QPoint
|
||||
inc ? 10 : -10, hoverRect.width()/2 + 4);
|
||||
p.restore();
|
||||
}
|
||||
|
||||
(void*)0;
|
||||
}
|
||||
|
||||
void dslDial::set_sel(uint64_t sel)
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
namespace pv {
|
||||
namespace view {
|
||||
|
||||
//when device is oscilloscope model, to draw the dail on the left
|
||||
//created by DsoSignal
|
||||
class dslDial : public QObject
|
||||
{
|
||||
//Q_OBJECT
|
||||
|
||||
@@ -38,6 +38,8 @@ class DsoSnapshot;
|
||||
|
||||
namespace view {
|
||||
|
||||
//when device is oscilloscope model,to draw trace
|
||||
//created by SigSession
|
||||
class DsoSignal : public Signal
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -40,6 +40,7 @@ class GroupSnapshot;
|
||||
|
||||
namespace view {
|
||||
|
||||
//created by SigSession
|
||||
class GroupSignal : public Trace
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -131,12 +131,15 @@ void Header::paintEvent(QPaintEvent*)
|
||||
const vector< boost::shared_ptr<Trace> > traces(
|
||||
_view.get_traces(ALL_VIEW));
|
||||
|
||||
// auto num = traces.size();
|
||||
|
||||
const bool dragging = !_drag_traces.empty();
|
||||
QColor fore(QWidget::palette().color(QWidget::foregroundRole()));
|
||||
fore.setAlpha(View::ForeAlpha);
|
||||
BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces)
|
||||
{
|
||||
assert(t);
|
||||
// auto ptr = t.get();
|
||||
t->paint_label(painter, w, dragging ? QPoint(-1, -1) : _mouse_point, fore);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ namespace view {
|
||||
class Trace;
|
||||
class View;
|
||||
|
||||
//the left panel of main graph
|
||||
//created by View
|
||||
class Header : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -38,12 +38,14 @@ class DsoSnapshot;
|
||||
|
||||
namespace view {
|
||||
|
||||
//when device is oscilloscope mode, it can use to draw Lissajous graph
|
||||
//created by SigSession
|
||||
class LissajousTrace : public Trace
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
static const int DIV_NUM = 10;
|
||||
static const int DIV_NUM = 10;
|
||||
|
||||
public:
|
||||
LissajousTrace(bool enable,
|
||||
|
||||
@@ -39,6 +39,8 @@ class Analog;
|
||||
|
||||
namespace view {
|
||||
|
||||
//when device is logic analyzer mode, to draw logic signal trace
|
||||
//created by SigSession
|
||||
class LogicSignal : public Signal
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -168,7 +168,7 @@ void Ruler::rel_grabbed_cursor()
|
||||
}
|
||||
|
||||
void Ruler::paintEvent(QPaintEvent*)
|
||||
{
|
||||
{
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter p(this);
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace view {
|
||||
class TimeMarker;
|
||||
class View;
|
||||
|
||||
//the rule panel on the top
|
||||
//created by View
|
||||
class Ruler : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace pv {
|
||||
|
||||
namespace view {
|
||||
|
||||
//Trace's base class
|
||||
class SelectableItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -50,6 +50,7 @@ class DevInst;
|
||||
|
||||
namespace view {
|
||||
|
||||
//draw signal trace base class
|
||||
class Signal : public Trace
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -40,6 +40,8 @@ class SpectrumStack;
|
||||
|
||||
namespace view {
|
||||
|
||||
//draw Scope signal trace
|
||||
//created by SigSession
|
||||
class SpectrumTrace : public Trace
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace view {
|
||||
|
||||
class View;
|
||||
|
||||
//the Cursor's base class
|
||||
class TimeMarker : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -67,6 +67,7 @@ class Trace;
|
||||
class Viewport;
|
||||
class LissajousFigure;
|
||||
|
||||
//created by MainWindow
|
||||
class View : public QScrollArea {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ bool Viewport::event(QEvent *event)
|
||||
}
|
||||
|
||||
void Viewport::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
{
|
||||
(void)event;
|
||||
|
||||
using pv::view::Signal;
|
||||
@@ -156,12 +156,15 @@ void Viewport::paintEvent(QPaintEvent *event)
|
||||
const vector< boost::shared_ptr<Trace> > traces(_view.get_traces(_type));
|
||||
BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces)
|
||||
{
|
||||
assert(t);
|
||||
assert(t);
|
||||
|
||||
t->paint_back(p, 0, _view.get_view_width(), fore, back);
|
||||
if (_view.back_ready())
|
||||
break;
|
||||
}
|
||||
|
||||
//auto st = _view.session().get_capture_state();
|
||||
|
||||
if (_view.session().get_device()->dev_inst()->mode == LOGIC ||
|
||||
_view.session().get_instant()) {
|
||||
switch(_view.session().get_capture_state()) {
|
||||
@@ -207,6 +210,10 @@ void Viewport::paintSignals(QPainter &p, QColor fore, QColor back)
|
||||
BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces)
|
||||
{
|
||||
assert(t);
|
||||
// auto ptr = t.get();
|
||||
// ptr->paint_mid(p, 0, t->get_view_rect().right(), fore, back);
|
||||
// continue;
|
||||
|
||||
if (t->enabled())
|
||||
t->paint_mid(p, 0, t->get_view_rect().right(), fore, back);
|
||||
}
|
||||
@@ -228,7 +235,7 @@ void Viewport::paintSignals(QPainter &p, QColor fore, QColor back)
|
||||
{
|
||||
assert(t);
|
||||
if (t->enabled())
|
||||
t->paint_mid(dbp, 0, t->get_view_rect().right(), fore, back);
|
||||
t->paint_mid(dbp, 0, t->get_view_rect().right(), fore, back);
|
||||
}
|
||||
_need_update = false;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ namespace view {
|
||||
class Signal;
|
||||
class View;
|
||||
|
||||
//main graph view port, in the middle region
|
||||
//draw the left and right rule scale
|
||||
//created by View
|
||||
class Viewport : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -41,12 +41,15 @@ namespace view {
|
||||
class View;
|
||||
class DsoSignal;
|
||||
|
||||
|
||||
//created by View
|
||||
class ViewStatus : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ViewStatus(SigSession &session, View &parent);
|
||||
ViewStatus(SigSession &session, View &parent);
|
||||
|
||||
public:
|
||||
|
||||
void paintEvent(QPaintEvent *);
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
|
||||
@@ -132,7 +132,7 @@ void XCursor::set_value(XCur_type type, double value)
|
||||
}
|
||||
|
||||
void XCursor::paint(QPainter &p, const QRect &rect, XCur_type highlight, int order)
|
||||
{
|
||||
{
|
||||
const int arrow = 3;
|
||||
const int x = rect.left() + _yvalue * rect.width();
|
||||
const int y0 = rect.top() + _value0 * rect.height();
|
||||
|
||||
@@ -41,9 +41,11 @@ namespace view {
|
||||
class View;
|
||||
class DsoSignal;
|
||||
|
||||
//created by View
|
||||
class XCursor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum XCur_type {
|
||||
XCur_None = -2,
|
||||
|
||||
@@ -168,8 +168,9 @@ static const struct DEMO_profile supported_Demo[] = {
|
||||
(1 << DEMO_LOGIC100x16) |
|
||||
(1 << DEMO_ANALOG10x2) |
|
||||
(1 << DEMO_DSO200x2),
|
||||
SR_Mn(100),
|
||||
SR_Kn(20),
|
||||
SR_Mn(100),
|
||||
// SR_Gn(16),
|
||||
SR_Kn(20),
|
||||
0,
|
||||
vdivs10to2000,
|
||||
0,
|
||||
|
||||
@@ -621,6 +621,7 @@ SR_API int sr_session_append(const char *filename, const unsigned char *buf,
|
||||
goto err;
|
||||
}
|
||||
if (zip_file_add(archive, chunk_name, logicsrc, ZIP_FL_OVERWRITE) == -1) {
|
||||
// if (zip_add(archive, chunk_name, logicsrc) == -1) {
|
||||
goto err;
|
||||
}
|
||||
if ((ret = zip_close(archive)) == -1) {
|
||||
|
||||
Reference in New Issue
Block a user