static void on_branch_combo_changed (GtkComboBox *combo_box, GitLogPane *self) { GtkTreeModel *log_branch_combo_model; gchar *branch; GtkTreeIter iter; gboolean active; log_branch_combo_model = gtk_combo_box_get_model (combo_box); if (gtk_combo_box_get_active_iter (combo_box, &iter)) { gtk_tree_model_get (log_branch_combo_model, &iter, BRANCH_COL_ACTIVE, &active, BRANCH_COL_NAME, &branch, -1); self->priv->viewing_active_branch = active; g_free (self->priv->selected_branch); self->priv->selected_branch = g_strdup (branch); g_free (branch); /* Refresh the log after the branches are refreshed so that everything * happens in a consistent order (refs, branches, log) and that * the log only gets refreshed once. Doing the refresh here also * lets us kill two birds with one stone: we can handle refreshes and * different branch selections all in one place. */ refresh_log (self); } }
/** * ctor mainwindow */ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); m_model = new model(this); proxyModel = new QSortFilterProxyModel(this); proxyModel->setSourceModel(m_model); proxyModel->setFilterRegExp(".*"); ui->tableView->setModel(proxyModel); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(on_pushButton_3_clicked())); timer->start(3000); QUrl url; url.setPath("index.html"); ui->texttextBrowserBrowser->setSource(url); on_loadCsvButton_clicked(); QObject::connect( &cmdLog, SIGNAL(doIt()), this, SLOT(refresh_log()) ); QObject::connect( &telemetryLog, SIGNAL(doIt()), this, SLOT(refresh_telemetry()) ); QObject::connect( &sPacketsBar, SIGNAL(doIt()), this, SLOT(refresh_sendPacketsBar()) ); ui->eightByteIndicator0->setText("XX"); ui->eightByteIndicator1->setText("XX"); ui->eightByteIndicator2->setText("XX"); ui->sevenByteIndicator0->setText("XX"); ui->sevenByteIndicator1->setText("XX"); ui->sevenByteIndicator2->setText("XX"); ui->sixByteIndicator0->setText("XX"); ui->sixByteIndicator1->setText("XX"); ui->sixByteIndicator2->setText("XX"); ui->fiveByteIndicator0->setText("XX"); ui->fiveByteIndicator1->setText("XX"); ui->fiveByteIndicator2->setText("XX"); ui->fourByteIndicator0->setText("XX"); ui->fourByteIndicator1->setText("XX"); ui->fourByteIndicator2->setText("XX"); ui->threeByteIndicator0->setText("XX"); ui->threeByteIndicator1->setText("XX"); ui->threeByteIndicator2->setText("XX"); ui->twoByteIndicator0->setText("XX"); ui->twoByteIndicator1->setText("XX"); ui->twoByteIndicator2->setText("XX"); ui->oneByteIndicator0->setText("XX"); ui->oneByteIndicator1->setText("XX"); ui->oneByteIndicator2->setText("XX"); initBootloaderStates(); initBootloaderOpcodes(); initBootloaderAbonCodes(); ui->sendPacketsBar->setRange( 0, 100 ); ui->sendPacketsBar->setValue( 0 ); QFile file("data.csv"); file.open(QIODevice::WriteOnly); QTextStream out(&file); out << " \"TIME\", \"TRAFFIC TYPE\",\"COMMAND NAME\",\"ABONENT RECEIVER\",\"ABONENT SENDER\",\"ATTR\",\"DATA\""; file.close(); }
static void on_path_entry_icon_release (GtkEntry *entry, GtkEntryIconPosition position, GdkEvent *event, GitLogPane *self) { if (position == GTK_ENTRY_ICON_SECONDARY) { if (self->priv->path) { g_free (self->priv->path); self->priv->path = NULL; refresh_log (self); } } }
static void on_log_pane_drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint target_type, guint time, GitLogPane *self) { Git *plugin; AnjutaEntry *path_entry; gboolean success; gchar **uri_list; GFile *parent_file; GFile *file; gchar *path; plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self))); path_entry = ANJUTA_ENTRY (gtk_builder_get_object (self->priv->builder, "path_entry")); success = FALSE; if ((data != NULL) && (gtk_selection_data_get_length (data) >= 0)) { if (target_type == 0) { uri_list = gtk_selection_data_get_uris (data); parent_file = NULL; parent_file = g_file_new_for_path (plugin->project_root_directory); /* Take only the first file */ file = g_file_new_for_uri (uri_list[0]); if (parent_file) { path = g_file_get_relative_path (parent_file, file); g_object_unref (parent_file); } else path = g_file_get_path (file); if (path) { anjuta_entry_set_text (path_entry, path); g_free (self->priv->path); self->priv->path = g_strdup (path); refresh_log (self); g_free (path); } success = TRUE; g_object_unref (file); g_strfreev (uri_list); } } /* Do not delete source data */ gtk_drag_finish (context, success, FALSE, time); }