QString FileBrowser::showLoadFile(const QString &path) { QString absPath = path; if (!QDir(path).exists()) { /* perhaps it is a file inside the directory */ if (QFile(path).exists()) { QDir dir(path); dir.cdUp(); absPath = dir.absolutePath(); /* TODO hilight that file */ } } if (!QFile(absPath).exists()) { absPath = QString(); } currentPath = realToVirtualPath(absPath); updateTreeView(); showMaximized(); onyx::screen::instance().flush(this, onyx::screen::ScreenProxy::GC); if (exec() == QDialog::Accepted) return currentRealPath; else return QString(); }
void QgsCptCityColorRampDialog::mTreeView_clicked( const QModelIndex &index ) { const QModelIndex &sourceIndex = mTreeFilter->mapToSource( index ); QgsCptCityDataItem *item = mModel->dataItem( sourceIndex ); if ( ! item ) return; QgsDebugMsg( QStringLiteral( "item %1 clicked" ).arg( item->name() ) ); buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false ); updateTreeView( item ); }
void ProjectAddDialog::addProject() { try { DBManager::getInstance().saveProject(ui.projectNameEdit->text()); } catch(int) { QMessageBox::critical(NULL, ("error"), ("project is exist"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); } updateTreeView(); }
void ProjectAddDialog::addAction() { QString projectName = ui.projectNameEdit->text(); if (projectName == "") { QMessageBox::critical(NULL, ("error"), ("please input the projectName first"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); } DBManager& dbManager = DBManager::getInstance(); int projectId = dbManager.getProjectIndex(projectName); dbManager.saveAction(ui.actionLineEdit->text(), projectId); updateTreeView(); }
void openFile(const std::string& filename) { std::ifstream file; file.open(filename.c_str(), std::ios::in | std::ios::binary); if (!file) { std::cerr << "Can't open file '" << filename << "'." << std::endl; return; } vmime::string data; char buffer[16384]; do { file.read(buffer, sizeof(buffer)); data += vmime::string(buffer, file.gcount()); } while (file.gcount()); std::shared_ptr<vmime::message> msg = std::make_shared<vmime::message>(); msg->parse(data); currentMessage = msg; char* convData = g_convert_with_fallback(data.c_str(), data.length(), "UTF-8", "ISO-8859-1", "?", NULL, NULL, NULL); if (convData == NULL) { gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(textArea)), "GLib UTF-8 conversion error.", -1); } else { gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(textArea)), convData, strlen(convData)); g_free(convData); } updateTreeView(); }
MainTreeView::MainTreeView(std::vector<Player>& players_list) : players_list(players_list) { //Create the Tree model: m_refTreeModel = Gtk::ListStore::create(m_Columns); set_model(m_refTreeModel); //Fill the TreeView's model updateTreeView(); //Add the TreeView's view columns: append_column("Rank", m_Columns.m_col_rank); append_column("ID", m_Columns.m_col_id); append_column("Name", m_Columns.m_col_name); append_column("Elo", m_Columns.m_col_elo); append_column("K Coefficient", m_Columns.m_col_kcoeff); //Fill popup menu: auto item = Gtk::manage(new Gtk::MenuItem("_Edit", true)); item->signal_activate().connect( sigc::mem_fun(*this, &MainTreeView::on_menu_file_popup_edit_player) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Add a Result", true)); item->signal_activate().connect( sigc::mem_fun(*this, &MainTreeView::on_menu_file_popup_add_result) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Remove", true)); item->signal_activate().connect( sigc::mem_fun(*this, &MainTreeView::on_menu_file_popup_remove_player) ); m_Menu_Popup.append(*item); m_Menu_Popup.accelerate(*this); m_Menu_Popup.show_all(); //Show all menu items when the menu pops up }
TrackerOutputViewer::TrackerOutputViewer(QWidget *parent) : QWidget(parent), ui(new Ui::TrackerOutputViewer) { ui->setupUi(this); connect(this->ui->tracker_output_sync_to_session, SIGNAL(toggled(bool)), this, SLOT(sync_to_dialog(bool))); connect(this->ui->tracker_output_session_id_combobox, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateTreeView(QString))); connect(this->ui->tracker_output_prev_session, SIGNAL(clicked()), this, SLOT(prev_output())); connect(this->ui->tracker_output_next_session, SIGNAL(clicked()), this, SLOT(next_output())); // Disable the close, minimize, maximize buttons QWidget::setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); }