From: Joel Holdsworth Date: Mon, 2 Jul 2012 20:29:56 +0000 (+0100) Subject: Made naming scheme consistent X-Git-Tag: pulseview-0.1.0~327 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=04abfae9c8f8e4884e6535d6584df8b5f1e3a1db;p=pulseview.git Made naming scheme consistent --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 50847e2a..510e552a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -43,30 +43,30 @@ extern "C" { MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), - ui(new Ui::MainWindow) + _ui(new Ui::MainWindow) { - ui->setupUi(this); + _ui->setupUi(this); _sampling_bar = new SamplingBar(this); connect(_sampling_bar, SIGNAL(run_stop()), this, SLOT(run_stop())); addToolBar(_sampling_bar); - view = new SigView(session, this); - ui->verticalLayout->addWidget(view); + _view = new SigView(_session, this); + _ui->verticalLayout->addWidget(_view); } MainWindow::~MainWindow() { - delete ui; + delete _ui; } void MainWindow::on_actionOpen_triggered() { - QString fileName = QFileDialog::getOpenFileName( + QString file_name = QFileDialog::getOpenFileName( this, tr("Open File"), "", tr("Sigrok Sessions (*.sr)")); - session.loadFile(fileName.toStdString()); + _session.load_file(file_name.toStdString()); } void MainWindow::on_actionAbout_triggered() @@ -77,7 +77,7 @@ void MainWindow::on_actionAbout_triggered() void MainWindow::run_stop() { - session.start_capture( + _session.start_capture( _sampling_bar->get_selected_device(), _sampling_bar->get_sample_rate()); } diff --git a/mainwindow.h b/mainwindow.h index 6ae608cc..da103c16 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -41,12 +41,12 @@ public: ~MainWindow(); private: - Ui::MainWindow *ui; + Ui::MainWindow *_ui; SamplingBar *_sampling_bar; - SigSession session; - SigView *view; + SigSession _session; + SigView *_view; private slots: diff --git a/sigsession.cpp b/sigsession.cpp index aecd21c2..21c5624b 100644 --- a/sigsession.cpp +++ b/sigsession.cpp @@ -32,25 +32,25 @@ using namespace boost; using namespace std; // TODO: This should not be necessary -SigSession* SigSession::session = NULL; +SigSession* SigSession::_session = NULL; SigSession::SigSession() { // TODO: This should not be necessary - session = this; + _session = this; } SigSession::~SigSession() { // TODO: This should not be necessary - session = NULL; + _session = NULL; } -void SigSession::loadFile(const std::string &name) +void SigSession::load_file(const std::string &name) { if (sr_session_load(name.c_str()) == SR_OK) { /* sigrok session file */ - sr_session_datafeed_callback_add(dataFeedInProc); + sr_session_datafeed_callback_add(data_feed_in_proc); sr_session_start(); sr_session_run(); sr_session_stop(); @@ -61,7 +61,7 @@ void SigSession::start_capture(struct sr_dev_inst *sdi, uint64_t sample_rate) { sr_session_new(); - sr_session_datafeed_callback_add(dataFeedInProc); + sr_session_datafeed_callback_add(data_feed_in_proc); if (sr_session_dev_add(sdi) != SR_OK) { qDebug() << "Failed to use device."; @@ -98,7 +98,7 @@ vector< shared_ptr >& SigSession::get_signals() return _signals; } -void SigSession::dataFeedIn(const struct sr_dev_inst *sdi, +void SigSession::data_feed_in(const struct sr_dev_inst *sdi, struct sr_datafeed_packet *packet) { assert(sdi); @@ -163,14 +163,14 @@ void SigSession::dataFeedIn(const struct sr_dev_inst *sdi, case SR_DF_END: _cur_logic_snapshot.reset(); - dataUpdated(); + data_updated(); break; } } -void SigSession::dataFeedInProc(const struct sr_dev_inst *sdi, +void SigSession::data_feed_in_proc(const struct sr_dev_inst *sdi, struct sr_datafeed_packet *packet) { - assert(session); - session->dataFeedIn(sdi, packet); + assert(_session); + _session->data_feed_in(sdi, packet); } diff --git a/sigsession.h b/sigsession.h index 851ca963..24726dfe 100644 --- a/sigsession.h +++ b/sigsession.h @@ -45,7 +45,7 @@ public: ~SigSession(); - void loadFile(const std::string &name); + void load_file(const std::string &name); void start_capture(struct sr_dev_inst* sdi, uint64_t sample_rate); @@ -53,10 +53,10 @@ public: get_signals(); private: - void dataFeedIn(const struct sr_dev_inst *sdi, + void data_feed_in(const struct sr_dev_inst *sdi, struct sr_datafeed_packet *packet); - static void dataFeedInProc(const struct sr_dev_inst *sdi, + static void data_feed_in_proc(const struct sr_dev_inst *sdi, struct sr_datafeed_packet *packet); private: @@ -65,13 +65,13 @@ private: boost::shared_ptr _cur_logic_snapshot; signals: - void dataUpdated(); + void data_updated(); private: // TODO: This should not be necessary. Multiple concurrent // sessions should should be supported and it should be // possible to associate a pointer with a sr_session. - static SigSession *session; + static SigSession *_session; }; #endif // SIGSESSION_H diff --git a/sigview.cpp b/sigview.cpp index 6a2b6204..8461af6e 100644 --- a/sigview.cpp +++ b/sigview.cpp @@ -52,8 +52,8 @@ SigView::SigView(SigSession &session, QWidget *parent) : _scale(1e-6), _offset(0) { - connect(&_session, SIGNAL(dataUpdated()), - this, SLOT(dataUpdated())); + connect(&_session, SIGNAL(data_updated()), + this, SLOT(data_updated())); setMouseTracking(true); setAutoFillBackground(false); @@ -65,7 +65,7 @@ void SigView::initializeGL() void SigView::resizeGL(int width, int height) { - setupViewport(width, height); + setup_viewport(width, height); } void SigView::paintEvent(QPaintEvent *event) @@ -80,7 +80,7 @@ void SigView::paintEvent(QPaintEvent *event) glMatrixMode(GL_MODELVIEW); glPushMatrix(); - setupViewport(width(), height()); + setup_viewport(width(), height()); qglClearColor(Qt::white); glClear(GL_COLOR_BUFFER_BIT); @@ -120,12 +120,12 @@ void SigView::paintEvent(QPaintEvent *event) } // Paint the ruler - paintRuler(painter); + paint_ruler(painter); painter.end(); } -void SigView::dataUpdated() +void SigView::data_updated() { update(); } @@ -165,7 +165,7 @@ void SigView::wheelEvent(QWheelEvent *event) update(); } -void SigView::setupViewport(int width, int height) +void SigView::setup_viewport(int width, int height) { glViewport(0, 0, (GLint)width, (GLint)height); glMatrixMode(GL_PROJECTION); @@ -174,7 +174,7 @@ void SigView::setupViewport(int width, int height) glMatrixMode(GL_MODELVIEW); } -void SigView::paintRuler(QPainter &p) +void SigView::paint_ruler(QPainter &p) { const double MinSpacing = 80; diff --git a/sigview.h b/sigview.h index d66898f4..2d450df2 100644 --- a/sigview.h +++ b/sigview.h @@ -61,12 +61,12 @@ private: void wheelEvent(QWheelEvent *event); private: - void setupViewport(int width, int height); + void setup_viewport(int width, int height); - void paintRuler(QPainter &p); + void paint_ruler(QPainter &p); private slots: - void dataUpdated(); + void data_updated(); private: SigSession &_session;