~hmatuschek/+junk/qdmr-package

« back to all changes in this revision

Viewing changes to src/application.cc

  • Committer: Hannes Matuschek
  • Date: 2020-07-07 14:34:22 UTC
  • mto: (17.1.1 qdmr-package)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: hmatuschek@gmail.com-20200707143422-1djcxrjkem3k5kb1
Tags: upstream-0.3.0
ImportĀ upstreamĀ versionĀ 0.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
  Settings settings;
30
30
  _repeater = new RepeaterDatabase(settings.position(), 7, this);
31
31
  _users    = new UserDatabase(30, this);
32
 
  _config = new Config(this);
 
32
  _config = new Config(_users, this);
33
33
 
34
34
  if (argc>1) {
35
35
    QFile file(argv[1]);
128
128
  QLineEdit *intro2 = _mainWindow->findChild<QLineEdit*>("introLine2");
129
129
  QSpinBox  *mic    = _mainWindow->findChild<QSpinBox *>("mic");
130
130
  QCheckBox *speech = _mainWindow->findChild<QCheckBox*>("speech");
 
131
  QCheckBox *userdb = _mainWindow->findChild<QCheckBox*>("uploadUserDB");
131
132
 
132
133
  dmrID->setText(QString::number(_config->id()));
133
134
  rname->setText(_config->name());
135
136
  intro2->setText(_config->introLine2());
136
137
  mic->setValue(_config->micLevel());
137
138
  speech->setChecked(_config->speech());
 
139
  userdb->setChecked(_config->uploadUserDB());
138
140
 
139
141
  connect(dmrID, SIGNAL(editingFinished()), this, SLOT(onDMRIDChanged()));
140
142
  connect(rname, SIGNAL(editingFinished()), this, SLOT(onNameChanged()));
142
144
  connect(intro2, SIGNAL(editingFinished()), this, SLOT(onIntroLine2Changed()));
143
145
  connect(mic, SIGNAL(valueChanged(int)), this, SLOT(onMicLevelChanged()));
144
146
  connect(speech, SIGNAL(toggled(bool)), this, SLOT(onSpeechChanged()));
 
147
  connect(userdb, SIGNAL(toggled(bool)), this, SLOT(onUploadUserDBChanged()));
145
148
 
146
149
  // Wire-up "Contact List" view
147
150
  QTableView *contacts = _mainWindow->findChild<QTableView *>("contactsView");
431
434
void
432
435
Application::uploadCodeplug() {
433
436
  // Start upload
 
437
  Settings settings;
434
438
  QString errorMessage;
435
439
  Radio *radio = Radio::detect(errorMessage);
436
440
  if (! radio) {
452
456
  connect(radio, SIGNAL(uploadProgress(int)), progress, SLOT(setValue(int)));
453
457
  connect(radio, SIGNAL(uploadError(Radio *)), this, SLOT(onCodeplugUploadError(Radio *)));
454
458
  connect(radio, SIGNAL(uploadComplete(Radio *)), this, SLOT(onCodeplugUploaded(Radio *)));
455
 
  radio->startUpload(_config, false);
 
459
  radio->startUpload(_config, false, settings.updateCodeplug());
456
460
 
457
461
  _mainWindow->statusBar()->showMessage(tr("Upload ..."));
458
462
  _mainWindow->setEnabled(false);
489
493
    Settings settings;
490
494
    settings.setQueryPosition(dialog.systemLocationEnabled());
491
495
    settings.setLocator(dialog.locator());
 
496
    settings.setUpdateCodeplug(dialog.updateCodeplug());
492
497
    if (! settings.queryPosition()) {
493
498
      _source->stopUpdates();
494
499
      _currentPosition = settings.position();
573
578
}
574
579
 
575
580
void
 
581
Application::onUploadUserDBChanged() {
 
582
  QCheckBox *userdb = _mainWindow->findChild<QCheckBox *>("uploadUserDB");
 
583
  _config->setUploadUserDB(userdb->isChecked());
 
584
}
 
585
 
 
586
void
576
587
Application::onIntroLine2Changed() {
577
588
  QLineEdit *line  = _mainWindow->findChild<QLineEdit*>("introLine2");
578
589
  _config->setIntroLine2(line->text().simplified());
581
592
 
582
593
void
583
594
Application::onAddContact() {
584
 
  ContactDialog dialog;
 
595
  ContactDialog dialog(_users);
585
596
  if (QDialog::Accepted != dialog.exec())
586
597
    return;
587
598
 
616
627
Application::onEditContact(const QModelIndex &idx) {
617
628
  if (idx.row() >= _config->contacts()->count())
618
629
    return;
619
 
  ContactDialog dialog(_config->contacts()->contact(idx.row()));
 
630
  ContactDialog dialog(_users, _config->contacts()->contact(idx.row()));
620
631
  if (QDialog::Accepted != dialog.exec())
621
632
    return;
622
633