void QDeclarativeGeoMapItemView::setModel(const QVariant &model) { QAbstractItemModel *itemModel = model.value<QAbstractItemModel *>(); if (itemModel == itemModel_) return; if (itemModel_) { disconnect(itemModel_, SIGNAL(modelReset()), this, SLOT(itemModelReset())); disconnect(itemModel_, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(itemModelRowsRemoved(QModelIndex,int,int))); disconnect(itemModel_, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(itemModelRowsInserted(QModelIndex,int,int))); itemModel_ = 0; } if (itemModel) { itemModel_ = itemModel; connect(itemModel_, SIGNAL(modelReset()), this, SLOT(itemModelReset())); connect(itemModel_, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(itemModelRowsRemoved(QModelIndex,int,int))); connect(itemModel_, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(itemModelRowsInserted(QModelIndex,int,int))); } repopulate(); emit modelChanged(); }
/** Initialize the frame Check if a gamepad is detected Check if the gamepad support rumbles */ void GamepadConfiguration::InitGamepadConfiguration() { repopulate(); // Set label and fit simulated key array /* * Check if there exist at least one pad available * if the pad id is 0, you need at least 1 gamepad connected, * if the pad id is 1, you need at least 2 gamepad connected, * Prevent to use a none initialized value on s_vgamePad (core dump) */ if (s_vgamePad.size() >= m_pad_id + 1) { /* * Determine if the device can use rumble * Use TestForce with a very low strength (can't be felt) * May be better to create a new function in order to check only that */ // Bad idea. Some connected devices might support rumble but not all connected devices. // if (!s_vgamePad[m_pad_id]->TestForce(0.001f)) { // wxMessageBox(L"Rumble is not available for your device."); // m_cb_rumble->Disable(); // disable the rumble checkbox // m_sl_rumble_intensity->Disable(); // disable the rumble intensity slider // } } else { wxMessageBox(L"No gamepad detected."); m_sl_joystick_sensibility->Disable(); // disable the joystick sensibility slider m_cb_rumble->Disable(); // disable the rumble checkbox m_sl_rumble_intensity->Disable(); // disable the rumble intensity slider } }
DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) { ui.setupUi(this); ui.dateEdit->setDisplayFormat(getDateFormat()); ui.tableWidget->setTitle(tr("Dive planner points")); ui.tableWidget->setModel(DivePlannerPointsModel::instance()); DivePlannerPointsModel::instance()->setRecalc(true); ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::GAS, new AirTypesDelegate(this)); ui.cylinderTableWidget->setTitle(tr("Available gases")); ui.cylinderTableWidget->setModel(CylindersModel::instance()); QTableView *view = ui.cylinderTableWidget->view(); view->setColumnHidden(CylindersModel::START, true); view->setColumnHidden(CylindersModel::END, true); view->setColumnHidden(CylindersModel::DEPTH, false); view->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this)); connect(ui.cylinderTableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addCylinder_clicked())); connect(ui.tableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addStop())); connect(CylindersModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), GasSelectionModel::instance(), SLOT(repopulate())); connect(CylindersModel::instance(), SIGNAL(rowsInserted(QModelIndex, int, int)), GasSelectionModel::instance(), SLOT(repopulate())); connect(CylindersModel::instance(), SIGNAL(rowsRemoved(QModelIndex, int, int)), GasSelectionModel::instance(), SLOT(repopulate())); connect(CylindersModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), plannerModel, SIGNAL(cylinderModelEdited())); connect(CylindersModel::instance(), SIGNAL(rowsInserted(QModelIndex, int, int)), plannerModel, SIGNAL(cylinderModelEdited())); connect(CylindersModel::instance(), SIGNAL(rowsRemoved(QModelIndex, int, int)), plannerModel, SIGNAL(cylinderModelEdited())); ui.tableWidget->setBtnToolTip(tr("Add dive data point")); connect(ui.startTime, SIGNAL(timeChanged(QTime)), plannerModel, SLOT(setStartTime(QTime))); connect(ui.dateEdit, SIGNAL(dateChanged(QDate)), plannerModel, SLOT(setStartDate(QDate))); connect(ui.ATMPressure, SIGNAL(valueChanged(int)), this, SLOT(atmPressureChanged(int))); connect(ui.atmHeight, SIGNAL(valueChanged(int)), this, SLOT(heightChanged(int))); connect(ui.salinity, SIGNAL(valueChanged(double)), this, SLOT(salinityChanged(double))); connect(DivePlannerPointsModel::instance(), SIGNAL(startTimeChanged(QDateTime)), this, SLOT(setupStartTime(QDateTime))); // Creating (and canceling) the plan replanButton = ui.buttonBox->addButton(tr("Save new"), QDialogButtonBox::ActionRole); connect(replanButton, SIGNAL(clicked()), plannerModel, SLOT(saveDuplicatePlan())); connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(savePlan())); connect(ui.buttonBox, SIGNAL(rejected()), plannerModel, SLOT(cancelPlan())); QShortcut *closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), this); connect(closeKey, SIGNAL(activated()), plannerModel, SLOT(cancelPlan())); // This makes shure the spinbox gets a setMinimum(0) on it so we can't have negative time or depth. ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::DEPTH, new SpinBoxDelegate(0, INT_MAX, 1, this)); ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::RUNTIME, new SpinBoxDelegate(0, INT_MAX, 1, this)); ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::DURATION, new SpinBoxDelegate(0, INT_MAX, 1, this)); ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::CCSETPOINT, new DoubleSpinBoxDelegate(0, 2, 0.1, this)); /* set defaults. */ ui.ATMPressure->setValue(1013); ui.atmHeight->setValue(0); setMinimumWidth(0); setMinimumHeight(0); }
void additional_parts_dialog::on_sort(wxCommandEvent &) { save_selection([&]() { mtx::sort::naturally(m_files.begin(), m_files.end()); repopulate(); }); }
/** Initialize the frame Check if a gamepad is detected */ void JoystickConfiguration::InitJoystickConfiguration() { repopulate(); // Set label and fit simulated key array /* * Check if there exist at least one pad available * if the pad id is 0, you need at least 1 gamepad connected, * if the pad id is 1, you need at least 2 gamepad connected, * Prevent to use a none initialized value on s_vgamePad (core dump) */ if(s_vgamePad.size() < m_pad_id+1) { wxMessageBox(L"No gamepad detected."); // disable all checkbox if(m_isForLeftJoystick) { m_cb_reverse_Lx->Disable(); m_cb_reverse_Ly->Disable(); } else { m_cb_reverse_Rx->Disable(); m_cb_reverse_Ry->Disable(); } } }
static void on_bookmark_list_changed (NautilusBookmarkList *bookmarks, gpointer data) { g_return_if_fail (NAUTILUS_IS_BOOKMARK_LIST (bookmarks)); /* maybe add logic here or in repopulate to save/restore selection */ repopulate (); }
void QDeclarativeGeoMapObjectView::setDelegate(QDeclarativeComponent *delegate) { if (!delegate) return; delegate_ = delegate; repopulate(); emit delegateChanged(); }
static void on_bookmark_list_changed (NautilusBookmarkList *bookmarks, gpointer user_data) { NautilusBookmarksWindow *self = user_data; /* maybe add logic here or in repopulate to save/restore selection */ repopulate (self); }
const PangoFontDescription* AP_UnixToolbar_StyleCombo::getStyle (const gchar *name) { const PangoFontDescription *desc = m_mapStyles.pick(name); if (desc == NULL) { repopulate(); desc = m_mapStyles.pick(name); } return desc; }
Playlist::DynamicTrackNavigator::DynamicTrackNavigator() : m_playlist( 0 ) { connect( m_model->qaim(), SIGNAL(activeTrackChanged(quint64)), SLOT(trackChanged()) ); connect( m_model->qaim(), SIGNAL(modelReset()), SLOT(repopulate()) ); connect( Dynamic::DynamicModel::instance(), SIGNAL(activeChanged(int)), SLOT(activePlaylistChanged()) ); activePlaylistChanged(); }
int main() { uint n, k; scanf("%u %u", &n, &k); heap<coord> h(k / 2 + 1); h.push(coord(n, n)); uint64 last = +INF; for (uint i = 0; i < k; i++) { while (h.front().value() >= last) { repopulate(h); } last = repopulate(h); printf("%llu\n", last); } return 0; }
FavoriteListWidget::FavoriteListWidget(BirdBox *b,ImageCache *i,QString user, QWidget *parent) : TweetListWidget(b,i,parent) { ui.title->setText(tr("Favourites")); QSettings settings; if (user!="") myUser = user; else myUser = settings.value("accounts/twitter/user").toString(); type=6; repopulate(); ui.type->setPixmap(QPixmap(":/buttons/favorite.png")); }
/* Mount FAT partition, discover which images we have, and fill in the list */ void MainWindow::populate() { if (!QFile::exists("/dev/mmcblk0p1")) { // mmcblk0p1 not ready yet, check back in a tenth of a second QTimer::singleShot(100, this, SLOT(populate())); return; } QProcess::execute("mount /dev/mmcblk0p1 /mnt"); QMap<QString,QString> images = listInstalledImages(); if (images.isEmpty()) { QMessageBox::critical(this, tr("No OS Images Found on SD Card"), tr("Please add at least one OS image to the /images directory in order to proceed")); _allowSilent = false; } // Fill in list of images repopulate(); if (!images.isEmpty()) { QList<QListWidgetItem *> l = ui->list->findItems(RECOMMENDED_IMAGE, Qt::MatchContains); if (!l.isEmpty()) { QListWidgetItem *recommendedItem = l.first(); recommendedItem->setText(recommendedItem->text()+" "+tr("[RECOMMENDED]")); ui->list->setCurrentItem(recommendedItem); } else { ui->list->setCurrentRow(0); } if (_allowSilent && !QFile::exists(FAT_PARTITION_OF_IMAGE) && images.count() == 1) { // No OS installed, perform silent installation qDebug() << "Performing silent installation"; _silent = true; on_actionWrite_image_to_disk_triggered(); } } bool osInstalled = QFile::exists(FAT_PARTITION_OF_IMAGE); ui->actionEdit_config->setEnabled(osInstalled); ui->actionCancel->setEnabled(osInstalled); }
void QDeclarativeGeoMapObjectView::setModel(const QVariant &model) { if (!model.isValid() || model == modelVariant_) return; QObject *object = qvariant_cast<QObject*>(model); QAbstractItemModel* itemModel; if (!object || !(itemModel = qobject_cast<QAbstractItemModel*>(object))) { return; } modelVariant_ = model; model_ = itemModel; // At the moment maps only works with landmark model. Because of this tight // restriction, we are not listening to all change signals. QObject::connect(model_, SIGNAL(modelReset()), this, SLOT(modelReset())); QObject::connect(model_, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(modelRowsRemoved(QModelIndex, int, int))); QObject::connect(model_, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(modelRowsInserted(QModelIndex, int, int))); repopulate(); emit modelChanged(); }
/* Checks for death of any ghosts/pacman and updates. It also makes a new level if all ghosts are dead or all dots are eaten. */ static void check_death(ModeInfo * mi, pacmangamestruct *pp) { Display *display = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); unsigned int ghost; int alldead; alldead = 1; for (ghost = 0; ghost < pp->nghosts; ghost++) { if (pp->ghosts[ghost].dead == True) continue; if ((pp->ghosts[ghost].nextrow == NOWHERE && pp->ghosts[ghost].nextcol == NOWHERE)) { alldead = 0; continue; } if (((pp->ghosts[ghost].nextrow == pp->pacman.nextrow) && (pp->ghosts[ghost].nextcol == pp->pacman.nextcol)) || ((pp->ghosts[ghost].nextrow == pp->pacman.row) && (pp->ghosts[ghost].nextcol == pp->pacman.col) && (pp->ghosts[ghost].row == pp->pacman.nextrow) && (pp->ghosts[ghost].col == pp->pacman.nextcol))) { pp->ghosts[ghost].dead = 1; XSetForeground(display, pp->stippledGC, MI_BLACK_PIXEL(mi)); XFillRectangle(display, window, pp->stippledGC, pp->ghosts[ghost].cf, pp->ghosts[ghost].rf, pp->spritexs, pp->spriteys); } else alldead = 0; } if (alldead == 1 || pp->dotsleft == 0) repopulate(mi); }
void additional_parts_dialog::on_down(wxCommandEvent &) { if (1 >= m_files.size()) return; save_selection([&]() { // Cannot use std::swap() on vector<bool> members due to specialization. std::vector<char> selected; for (size_t idx = 0; m_files.size() > idx; ++idx) selected.push_back(m_lv_files->IsSelected(idx)); for (int idx = m_files.size() - 2; 0 <= idx; --idx) if (selected[idx] && !selected[idx + 1]) { std::swap(m_files[idx + 1], m_files[idx]); std::swap(selected[idx + 1], selected[idx]); } repopulate(); }); }
void QScriptDebuggerLocalsModelPrivate::reallySyncIndex(const QModelIndex &index, const QScriptDebuggerObjectSnapshotDelta &delta) { if (!index.isValid()) return; QScriptDebuggerLocalsModelNode *node = nodeFromIndex(index); // update or remove existing children for (int i = 0; i < node->children.count(); ++i) { QScriptDebuggerLocalsModelNode *child = node->children.at(i); int j; for (j = 0; j < delta.changedProperties.count(); ++j) { if (child->property.name() == delta.changedProperties.at(j).name()) { child->property = delta.changedProperties.at(j); child->changed = true; emitDataChanged(index, index.sibling(0, 1)); repopulate(child); break; } } if (j != delta.changedProperties.count()) continue; // was changed for (j = 0; j < delta.removedProperties.count(); ++j) { if (child->property.name() == delta.removedProperties.at(j)) { removeChild(index, node, i); --i; break; } } if (j != delta.removedProperties.count()) continue; // was removed // neither changed nor removed, but its children might be if (child->populationState == QScriptDebuggerLocalsModelNode::Populated) { QScriptDebuggerJob *job = new SyncModelIndexJob(indexFromNode(child), commandScheduler); jobScheduler->scheduleJob(job); } } addChildren(index, node, delta.addedProperties); }
void update() { create_columns(); repopulate(); }
additional_parts_dialog::additional_parts_dialog(wxWindow *parent, mmg_file_t const &file) : wxDialog(parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , m_file{&file} , m_primary_file_name{m_file->file_name} , m_files{ m_file->is_playlist ? m_file->playlist_files : m_file->other_files } { SetTitle(m_file->is_playlist ? Z("View files in playlist") : Z("Additional source file parts")); // Create controls m_lv_files = new wxListView(this, ID_ADDPARTS_LV_FILES, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxSUNKEN_BORDER); m_b_add = new wxButton(this, ID_ADDPARTS_B_ADD, Z("&Add")); m_b_remove = new wxButton(this, ID_ADDPARTS_B_REMOVE, Z("&Remove")); m_b_up = new wxButton(this, ID_ADDPARTS_B_UP, Z("&Up")); m_b_down = new wxButton(this, ID_ADDPARTS_B_DOWN, Z("&Down")); m_b_sort = new wxButton(this, ID_ADDPARTS_B_SORT, Z("&Sort")); m_b_close = new wxButton(this, ID_ADDPARTS_B_CLOSE, Z("&Close")); auto *st_title = new wxStaticText(this, wxID_ANY, m_file->is_playlist ? Z("View files in playlist") : Z("Edit additional source file parts")); auto *st_primary_file_name = new wxStaticText(this, wxID_ANY, Z("Primary file name:")); auto *st_directory = new wxStaticText(this, wxID_ANY, Z("Directory:")); wxString text; if (m_file->is_playlist) { text = wxString( Z("The following list shows the files that make up this playlist.") ) + wxT(" ") + Z("This list is for informational purposes only and cannot be changed."); } else { text = wxString( Z("The following parts are read after the primary file as if they were all part of one big file.") ) + wxT(" ") + Z("Typical use cases include reading VOBs from a DVD (e.g. VTS_01_1.VOB, VTS_01_2.VOB, VTS_01_3.VOB)."); } auto *st_additional_parts = new wxStaticText(this, wxID_ANY, wxString{ format_paragraph(to_wide(text), 0, L"", L"", 80) }.Strip()); auto *sl_title = new wxStaticLine(this); auto *tc_primary_file_name = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); auto *tc_directory = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); // Setup controls wxListItem column_item; column_item.SetMask(wxLIST_MASK_TEXT); column_item.SetText(Z("File name")); m_lv_files->InsertColumn(0, column_item); column_item.SetText(Z("Directory")); m_lv_files->InsertColumn(1, column_item); auto dummy = m_lv_files->InsertItem(0, wxT("some long file name dummy.mkv")); m_lv_files->SetItem(dummy, 1, wxT("and the path is even longer but hey such is life")); m_lv_files->SetColumnWidth(0, wxLIST_AUTOSIZE); m_lv_files->SetColumnWidth(1, wxLIST_AUTOSIZE); m_lv_files->DeleteItem(0); repopulate(); tc_primary_file_name->SetValue(m_primary_file_name.GetFullName()); tc_directory->SetValue(m_primary_file_name.GetPath()); enable_buttons(); // Create layout auto *siz_all = new wxBoxSizer(wxVERTICAL); siz_all->Add(st_title, 0, wxALL, 5); siz_all->Add(sl_title, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5); auto *siz_primary_file_name = new wxFlexGridSizer(2, 2, 5, 5); siz_primary_file_name->AddGrowableCol(1); siz_primary_file_name->Add(st_primary_file_name); siz_primary_file_name->Add(tc_primary_file_name, 0, wxGROW); siz_primary_file_name->Add(st_directory); siz_primary_file_name->Add(tc_directory, 0, wxGROW); siz_all->Add(siz_primary_file_name, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5); siz_all->Add(st_additional_parts, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5); auto *siz_buttons = new wxBoxSizer(wxVERTICAL); siz_buttons->Add(m_b_add, 0, wxBOTTOM, 5); siz_buttons->Add(m_b_remove, 0, wxBOTTOM, 15); siz_buttons->Add(m_b_up, 0, wxBOTTOM, 5); siz_buttons->Add(m_b_down, 0, wxBOTTOM, 15); siz_buttons->Add(m_b_sort, 0, wxBOTTOM, 0); siz_buttons->AddStretchSpacer(); siz_buttons->Add(m_b_close); auto *siz_controls = new wxBoxSizer(wxHORIZONTAL); siz_controls->Add(m_lv_files, 1, wxGROW); siz_controls->Add(siz_buttons, 0, wxGROW | wxLEFT, 5); siz_all->Add(siz_controls, 1, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5); SetSizerAndFit(siz_all); siz_all->SetSizeHints(this); SetSize(wxSize(700, 400)); // Run ShowModal(); }
AllTweetsListWidget::AllTweetsListWidget(BirdBox *b,ImageCache *i, QWidget *parent) : TweetListWidget(b,i,parent) { repopulate(); }
// Construtor of GamepadConfiguration GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent) : wxDialog( parent, // Parent wxID_ANY, // ID _T("Gamepad configuration"), // Title wxDefaultPosition, // Position wxSize(400, 230), // Width + Lenght // Style wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN) { m_pad_id = pad; m_pan_gamepad_config = new wxPanel( this, // Parent wxID_ANY, // ID wxDefaultPosition, // Prosition wxSize(300, 200) // Size ); m_cb_rumble = new wxCheckBox( m_pan_gamepad_config, // Parent wxID_ANY, // ID _T("&Enable rumble"), // Label wxPoint(20, 20) // Position ); m_cb_hack_sixaxis_usb = new wxCheckBox( m_pan_gamepad_config, // Parent wxID_ANY, // ID _T("&Hack: Sixaxis/DS3 plugged in USB"), // Label wxPoint(20, 40) // Position ); m_cb_hack_sixaxis_pressure = new wxCheckBox( m_pan_gamepad_config, // Parent wxID_ANY, // ID _T("&Hack: Sixaxis/DS3 pressure"), // Label wxPoint(20, 60) // Position ); wxString txt_rumble = wxT("Rumble intensity"); m_lbl_rumble_intensity = new wxStaticText( m_pan_gamepad_config, // Parent wxID_ANY, // ID txt_rumble, // Text which must be displayed wxPoint(20, 90), // Position wxDefaultSize // Size ); m_sl_rumble_intensity = new wxSlider( m_pan_gamepad_config, // Parent wxID_ANY, // ID 0, // value 0, // min value 0x0000 0x7FFF, // max value 0x7FFF wxPoint(150, 83), // Position wxSize(200, 30) // Size ); wxString txt_joystick = wxT("Joystick sensibility"); m_lbl_rumble_intensity = new wxStaticText( m_pan_gamepad_config, // Parent wxID_ANY, // ID txt_joystick, // Text which must be displayed wxPoint(20, 120), // Position wxDefaultSize // Size ); m_sl_joystick_sensibility = new wxSlider( m_pan_gamepad_config, // Parent wxID_ANY, // ID 0, // value 0, // min value 100, // max value wxPoint(150, 113), // Position wxSize(200, 30) // Size ); m_bt_ok = new wxButton( m_pan_gamepad_config, // Parent wxID_ANY, // ID _T("&OK"), // Label wxPoint(250, 160), // Position wxSize(60, 25) // Size ); m_bt_cancel = new wxButton( m_pan_gamepad_config, // Parent wxID_ANY, // ID _T("&Cancel"), // Label wxPoint(320, 160), // Position wxSize(60, 25) // Size ); Bind(wxEVT_BUTTON, &GamepadConfiguration::OnButtonClicked, this); Bind(wxEVT_SCROLL_THUMBRELEASE, &GamepadConfiguration::OnSliderReleased, this); Bind(wxEVT_CHECKBOX, &GamepadConfiguration::OnCheckboxChange, this); repopulate(); }
// Construtor of GamepadConfiguration GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent) : wxDialog( parent, // Parent wxID_ANY, // ID _T("Gamepad configuration"), // Title wxDefaultPosition, // Position wxSize(400, 230), // Width + Lenght // Style wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN) { m_pad_id = pad; m_pan_gamepad_config = new wxPanel( this, // Parent wxID_ANY, // ID wxDefaultPosition, // Prosition wxSize(300, 200) // Size ); m_cb_rumble = new wxCheckBox( m_pan_gamepad_config, // Parent wxID_ANY, // ID _T("&Enable rumble"), // Label wxPoint(20, 20) // Position ); wxArrayString choices; for (const auto &j : s_vgamePad) { choices.Add(j->GetName()); } m_joy_map = new wxChoice( m_pan_gamepad_config, // Parent wxID_ANY, // ID wxPoint(20, 50), // Position wxDefaultSize, // Size choices); wxString txt_rumble = wxT("Rumble intensity"); m_lbl_rumble_intensity = new wxStaticText( m_pan_gamepad_config, // Parent wxID_ANY, // ID txt_rumble, // Text which must be displayed wxPoint(20, 90), // Position wxDefaultSize // Size ); m_sl_rumble_intensity = new wxSlider( m_pan_gamepad_config, // Parent wxID_ANY, // ID 0, // value 0, // min value 0x0000 0x7FFF, // max value 0x7FFF wxPoint(150, 83), // Position wxSize(200, 30) // Size ); wxString txt_joystick = wxT("Joystick sensibility"); m_lbl_rumble_intensity = new wxStaticText( m_pan_gamepad_config, // Parent wxID_ANY, // ID txt_joystick, // Text which must be displayed wxPoint(20, 120), // Position wxDefaultSize // Size ); m_sl_joystick_sensibility = new wxSlider( m_pan_gamepad_config, // Parent wxID_ANY, // ID 0, // value 0, // min value 100, // max value wxPoint(150, 113), // Position wxSize(200, 30) // Size ); m_bt_ok = new wxButton( m_pan_gamepad_config, // Parent wxID_ANY, // ID _T("&OK"), // Label wxPoint(320, 160), // Position wxSize(60, 25) // Size ); Bind(wxEVT_BUTTON, &GamepadConfiguration::OnButtonClicked, this); Bind(wxEVT_SCROLL_THUMBRELEASE, &GamepadConfiguration::OnSliderReleased, this); Bind(wxEVT_CHECKBOX, &GamepadConfiguration::OnCheckboxChange, this); Bind(wxEVT_CHOICE, &GamepadConfiguration::OnChoiceChange, this); repopulate(); }
/** * create_bookmarks_window: * * Create a new bookmark-editing window. * @list: The NautilusBookmarkList that this window will edit. * * Return value: A pointer to the new window. **/ GtkWindow * create_bookmarks_window (NautilusBookmarkList *list, GObject *undo_manager_source) { GtkWidget *window; GtkTreeViewColumn *col; GtkCellRenderer *rend; GtkBuilder *builder; bookmarks = list; builder = gtk_builder_new (); if (!gtk_builder_add_from_file (builder, UIDIR "/nautilus-bookmarks-window.ui", NULL)) { return NULL; } window = (GtkWidget *)gtk_builder_get_object (builder, "bookmarks_dialog"); bookmark_list_widget = (GtkTreeView *)gtk_builder_get_object (builder, "bookmark_tree_view"); remove_button = (GtkWidget *)gtk_builder_get_object (builder, "bookmark_delete_button"); jump_button = (GtkWidget *)gtk_builder_get_object (builder, "bookmark_jump_button"); set_up_close_accelerator (window); nautilus_undo_share_undo_manager (G_OBJECT (window), undo_manager_source); gtk_window_set_wmclass (GTK_WINDOW (window), "bookmarks", "Nautilus"); nautilus_bookmarks_window_restore_geometry (window); g_object_weak_ref (G_OBJECT (undo_manager_source), edit_bookmarks_dialog_reset_signals, undo_manager_source); bookmark_list_widget = GTK_TREE_VIEW (gtk_builder_get_object (builder, "bookmark_tree_view")); rend = gtk_cell_renderer_pixbuf_new (); col = gtk_tree_view_column_new_with_attributes ("Icon", rend, "gicon", BOOKMARK_LIST_COLUMN_ICON, NULL); gtk_tree_view_append_column (bookmark_list_widget, GTK_TREE_VIEW_COLUMN (col)); gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (col), NAUTILUS_ICON_SIZE_SMALLER); rend = gtk_cell_renderer_text_new (); g_object_set (rend, "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, NULL); col = gtk_tree_view_column_new_with_attributes ("Icon", rend, "text", BOOKMARK_LIST_COLUMN_NAME, "style", BOOKMARK_LIST_COLUMN_STYLE, NULL); gtk_tree_view_append_column (bookmark_list_widget, GTK_TREE_VIEW_COLUMN (col)); bookmark_list_store = create_bookmark_store (); setup_empty_list (); gtk_tree_view_set_model (bookmark_list_widget, GTK_TREE_MODEL (bookmark_empty_list_store)); bookmark_selection = GTK_TREE_SELECTION (gtk_tree_view_get_selection (bookmark_list_widget)); name_field = nautilus_entry_new (); gtk_widget_show (name_field); gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (builder, "bookmark_name_placeholder")), name_field, TRUE, TRUE, 0); gtk_label_set_mnemonic_widget ( GTK_LABEL (gtk_builder_get_object (builder, "bookmark_name_label")), name_field); uri_field = nautilus_entry_new (); gtk_widget_show (uri_field); gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (builder, "bookmark_location_placeholder")), uri_field, TRUE, TRUE, 0); gtk_label_set_mnemonic_widget ( GTK_LABEL (gtk_builder_get_object (builder, "bookmark_location_label")), uri_field); bookmark_list_changed_signal_id = g_signal_connect (bookmarks, "changed", G_CALLBACK (on_bookmark_list_changed), NULL); row_changed_signal_id = g_signal_connect (bookmark_list_store, "row_changed", G_CALLBACK (on_row_changed), NULL); row_deleted_signal_id = g_signal_connect (bookmark_list_store, "row_deleted", G_CALLBACK (on_row_deleted), NULL); row_activated_signal_id = g_signal_connect (bookmark_list_widget, "row_activated", G_CALLBACK (on_row_activated), undo_manager_source); button_pressed_signal_id = g_signal_connect (bookmark_list_widget, "button_press_event", G_CALLBACK (on_button_pressed), NULL); key_pressed_signal_id = g_signal_connect (bookmark_list_widget, "key_press_event", G_CALLBACK (on_key_pressed), NULL); selection_changed_id = g_signal_connect (bookmark_selection, "changed", G_CALLBACK (on_selection_changed), NULL); g_signal_connect (window, "delete_event", G_CALLBACK (on_window_delete_event), NULL); g_signal_connect (window, "hide", G_CALLBACK (on_window_hide_event), NULL); g_signal_connect (window, "destroy", G_CALLBACK (on_window_destroy_event), NULL); g_signal_connect (window, "response", G_CALLBACK (nautilus_bookmarks_window_response_callback), NULL); name_field_changed_signal_id = g_signal_connect (name_field, "changed", G_CALLBACK (on_name_field_changed), NULL); g_signal_connect (name_field, "focus_out_event", G_CALLBACK (on_text_field_focus_out_event), NULL); g_signal_connect (name_field, "activate", G_CALLBACK (name_or_uri_field_activate), NULL); uri_field_changed_signal_id = g_signal_connect (uri_field, "changed", G_CALLBACK (on_uri_field_changed), NULL); g_signal_connect (uri_field, "focus_out_event", G_CALLBACK (on_text_field_focus_out_event), NULL); g_signal_connect (uri_field, "activate", G_CALLBACK (name_or_uri_field_activate), NULL); g_signal_connect (remove_button, "clicked", G_CALLBACK (on_remove_button_clicked), NULL); jump_button_signal_id = g_signal_connect (jump_button, "clicked", G_CALLBACK (on_jump_button_clicked), undo_manager_source); gtk_tree_selection_set_mode (bookmark_selection, GTK_SELECTION_BROWSE); /* Fill in list widget with bookmarks, must be after signals are wired up. */ repopulate(); g_object_unref (builder); return GTK_WINDOW (window); }
/*! \internal */ void QDeclarativeGeoMapItemView::itemModelReset() { repopulate(); }
// necessary because it has to be constructed before Playlist::instance(), but also connect to it void DynamicBar::init() { connect(Playlist::instance()->qscrollview(), SIGNAL(dynamicModeChanged(const DynamicMode*)), SLOT(slotNewDynamicMode(const DynamicMode*))); KPushButton* editDynamicButton = new KPushButton( i18n("Edit"), this, "DynamicModeEdit" ); connect( editDynamicButton, SIGNAL(clicked()), Playlist::instance()->qscrollview(), SLOT(editActiveDynamicMode()) ); KPushButton* repopButton = new KPushButton( i18n("Repopulate"), this, "DynamicModeRepopulate" ); connect( repopButton, SIGNAL(clicked()), Playlist::instance()->qscrollview(), SLOT(repopulate()) ); KPushButton* disableButton = new KPushButton( i18n("Turn Off"), this, "DynamicModeDisable" ); connect( disableButton, SIGNAL(clicked()), Playlist::instance()->qscrollview(), SLOT(disableDynamicMode()) ); slotNewDynamicMode( Playlist::instance()->dynamicMode() ); }
void Dialog::InitDialog() { GamePad::EnumerateGamePads(s_vgamePad); // activate gamepads LoadConfig(); // Load configuration from the ini file repopulate(); // Set label and fit simulated key array }
void RandGenerator::reset(bool repeatable) { repopulate(); mHistory.clear(); mIsRepeatable = repeatable; }
void QDeclarativeGeoMapObjectView::modelReset() { repopulate(); }
/* Callback to change level. */ void change_pacman(ModeInfo * mi) { MI_CLEARWINDOW(mi); repopulate(mi); }
static void nautilus_bookmarks_window_constructed (GObject *object) { NautilusBookmarksWindow *self = NAUTILUS_BOOKMARKS_WINDOW (object); GtkBuilder *builder; GError *error = NULL; GtkWindow *window; GtkWidget *content; GtkTreeViewColumn *col; GtkCellRenderer *rend; G_OBJECT_CLASS (nautilus_bookmarks_window_parent_class)->constructed (object); builder = gtk_builder_new (); if (!gtk_builder_add_from_resource (builder, "/org/gnome/nautilus/nautilus-bookmarks-window.ui", &error)) { g_object_unref (builder); g_critical ("Can't load UI description for the bookmarks editor: %s", error->message); g_error_free (error); return; } window = GTK_WINDOW (object); gtk_window_set_title (window, _("Bookmarks")); gtk_window_set_default_size (window, BOOKMARKS_WINDOW_INITIAL_WIDTH, BOOKMARKS_WINDOW_INITIAL_HEIGHT); gtk_window_set_application (window, gtk_window_get_application (GTK_WINDOW (self->priv->parent_window))); gtk_window_set_destroy_with_parent (window, TRUE); gtk_window_set_transient_for (window, GTK_WINDOW (self->priv->parent_window)); gtk_window_set_position (window, GTK_WIN_POS_CENTER_ON_PARENT); gtk_container_set_border_width (GTK_CONTAINER (window), 6); g_signal_connect (window, "key-press-event", G_CALLBACK (nautilus_bookmarks_window_key_press_event_cb), NULL); content = GTK_WIDGET (gtk_builder_get_object (builder, "bookmarks_window_content")); gtk_container_add (GTK_CONTAINER (window), content); /* tree view */ self->priv->tree_view = GTK_TREE_VIEW (gtk_builder_get_object (builder, "bookmark_tree_view")); self->priv->selection = gtk_tree_view_get_selection (self->priv->tree_view); gtk_tree_selection_set_mode (self->priv->selection, GTK_SELECTION_BROWSE); rend = gtk_cell_renderer_pixbuf_new (); g_object_set (rend, "follow-state", TRUE, NULL); col = gtk_tree_view_column_new_with_attributes ("Icon", rend, "gicon", BOOKMARK_LIST_COLUMN_ICON, NULL); gtk_tree_view_append_column (self->priv->tree_view, GTK_TREE_VIEW_COLUMN (col)); gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (col), NAUTILUS_ICON_SIZE_SMALLER); rend = gtk_cell_renderer_text_new (); g_object_set (rend, "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, NULL); col = gtk_tree_view_column_new_with_attributes ("Icon", rend, "text", BOOKMARK_LIST_COLUMN_NAME, "style", BOOKMARK_LIST_COLUMN_STYLE, NULL); gtk_tree_view_append_column (self->priv->tree_view, GTK_TREE_VIEW_COLUMN (col)); self->priv->model = create_bookmark_store (); setup_empty_list (self); /* name entry */ self->priv->name_field = nautilus_entry_new (); gtk_widget_show (self->priv->name_field); gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (builder, "bookmark_name_placeholder")), self->priv->name_field, TRUE, TRUE, 0); gtk_label_set_mnemonic_widget ( GTK_LABEL (gtk_builder_get_object (builder, "bookmark_name_label")), self->priv->name_field); /* URI entry */ self->priv->uri_field = nautilus_entry_new (); gtk_widget_show (self->priv->uri_field); gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (builder, "bookmark_location_placeholder")), self->priv->uri_field, TRUE, TRUE, 0); gtk_label_set_mnemonic_widget ( GTK_LABEL (gtk_builder_get_object (builder, "bookmark_location_label")), self->priv->uri_field); /* buttons */ self->priv->remove_button = GTK_WIDGET (gtk_builder_get_object (builder, "bookmark_remove_button")); self->priv->up_button = GTK_WIDGET (gtk_builder_get_object (builder, "bookmark_up_button")); self->priv->down_button = GTK_WIDGET (gtk_builder_get_object (builder, "bookmark_down_button")); g_object_unref (builder); /* setup bookmarks list and signals */ self->priv->bookmarks = nautilus_application_get_bookmarks (NAUTILUS_APPLICATION (g_application_get_default ())); self->priv->bookmarks_changed_id = g_signal_connect (self->priv->bookmarks, "changed", G_CALLBACK (on_bookmark_list_changed), self); self->priv->row_changed_id = g_signal_connect (self->priv->model, "row-changed", G_CALLBACK (on_row_changed), self); self->priv->row_deleted_id = g_signal_connect (self->priv->model, "row-deleted", G_CALLBACK (on_row_deleted), self); self->priv->row_activated_id = g_signal_connect (self->priv->tree_view, "row-activated", G_CALLBACK (on_row_activated), self); self->priv->button_press_id = g_signal_connect (self->priv->tree_view, "button-press-event", G_CALLBACK (on_button_pressed), self); self->priv->key_press_id = g_signal_connect (self->priv->tree_view, "key-press-event", G_CALLBACK (on_key_pressed), self); self->priv->selection_changed_id = g_signal_connect (self->priv->selection, "changed", G_CALLBACK (on_selection_changed), self); self->priv->name_changed_id = g_signal_connect (self->priv->name_field, "changed", G_CALLBACK (on_name_field_changed), self); g_signal_connect (self->priv->name_field, "focus_out_event", G_CALLBACK (on_text_field_focus_out_event), self); g_signal_connect (self->priv->name_field, "activate", G_CALLBACK (name_or_uri_field_activate), self); self->priv->uri_changed_id = g_signal_connect (self->priv->uri_field, "changed", G_CALLBACK (on_uri_field_changed), self); g_signal_connect (self->priv->uri_field, "focus_out_event", G_CALLBACK (on_text_field_focus_out_event), self); g_signal_connect (self->priv->uri_field, "activate", G_CALLBACK (name_or_uri_field_activate), self); g_signal_connect (self->priv->remove_button, "clicked", G_CALLBACK (on_remove_button_clicked), self); g_signal_connect (self->priv->up_button, "clicked", G_CALLBACK (on_up_button_clicked), self); g_signal_connect (self->priv->down_button, "clicked", G_CALLBACK (on_down_button_clicked), self); /* Fill in list widget with bookmarks, must be after signals are wired up. */ repopulate (self); }