comparison multichoicedialog.cpp @ 74:10eb97683aa9

* Show branch names even for changes with children, if those children are on a different branch * Pick up remote repo path from local repo via hg paths * Some work towards breaking down files into various groups based on status * Add /usr/local/bin to path for hg (temporary hack I hope)
author Chris Cannam
date Fri, 19 Nov 2010 14:54:19 +0000
parents 121cb1032717
children aaeabc920ca8
comparison
equal deleted inserted replaced
73:a773c6e7b301 74:10eb97683aa9
50 50
51 QFont f = m_descriptionLabel->font(); 51 QFont f = m_descriptionLabel->font();
52 f.setPointSize(f.pointSize() * 0.9); 52 f.setPointSize(f.pointSize() * 0.9);
53 m_descriptionLabel->setFont(f); 53 m_descriptionLabel->setFont(f);
54 54
55 m_urlLabel = new QLabel(tr("URL:")); 55 m_urlLabel = new QLabel(tr("&URL:"));
56 outer->addWidget(m_urlLabel, 3, 0); 56 outer->addWidget(m_urlLabel, 3, 0);
57 57
58 m_urlCombo = new QComboBox(); 58 m_urlCombo = new QComboBox();
59 m_urlCombo->setEditable(true); 59 m_urlCombo->setEditable(true);
60 m_urlLabel->setBuddy(m_urlCombo);
60 connect(m_urlCombo, SIGNAL(editTextChanged(const QString &)), 61 connect(m_urlCombo, SIGNAL(editTextChanged(const QString &)),
61 this, SLOT(urlChanged(const QString &))); 62 this, SLOT(urlChanged(const QString &)));
62 outer->addWidget(m_urlCombo, 3, 1, 1, 2); 63 outer->addWidget(m_urlCombo, 3, 1, 1, 2);
63 64
64 m_fileLabel = new QLabel(tr("File:")); 65 m_fileLabel = new QLabel(tr("&File:"));
65 outer->addWidget(m_fileLabel, 4, 0); 66 outer->addWidget(m_fileLabel, 4, 0);
66 67
67 m_fileCombo = new QComboBox(); 68 m_fileCombo = new QComboBox();
68 m_fileCombo->setEditable(true); 69 m_fileCombo->setEditable(true);
70 m_fileLabel->setBuddy(m_fileCombo);
71 connect(m_fileCombo, SIGNAL(editTextChanged(const QString &)),
72 this, SLOT(fileChanged(const QString &)));
69 outer->addWidget(m_fileCombo, 4, 1); 73 outer->addWidget(m_fileCombo, 4, 1);
70 outer->setColumnStretch(1, 20); 74 outer->setColumnStretch(1, 20);
71 75
72 m_browseButton = new QPushButton(tr("Browse...")); 76 m_browseButton = new QPushButton(tr("Browse..."));
73 outer->addWidget(m_browseButton, 4, 2); 77 outer->addWidget(m_browseButton, 4, 2);
76 QDialogButtonBox *bbox = new QDialogButtonBox(QDialogButtonBox::Ok | 80 QDialogButtonBox *bbox = new QDialogButtonBox(QDialogButtonBox::Ok |
77 QDialogButtonBox::Cancel); 81 QDialogButtonBox::Cancel);
78 connect(bbox, SIGNAL(accepted()), this, SLOT(accept())); 82 connect(bbox, SIGNAL(accepted()), this, SLOT(accept()));
79 connect(bbox, SIGNAL(rejected()), this, SLOT(reject())); 83 connect(bbox, SIGNAL(rejected()), this, SLOT(reject()));
80 outer->addWidget(bbox, 5, 0, 1, 3); 84 outer->addWidget(bbox, 5, 0, 1, 3);
81 85
86 m_okButton = bbox->button(QDialogButtonBox::Ok);
87 m_okButton->setEnabled(false);
88
82 setMinimumWidth(480); 89 setMinimumWidth(480);
83 } 90 }
84 91
85 QString 92 QString
86 MultiChoiceDialog::getCurrentChoice() 93 MultiChoiceDialog::getCurrentChoice()
213 } 220 }
214 m_fileCombo->lineEdit()->setText(dirPath.filePath(urlDirName)); 221 m_fileCombo->lineEdit()->setText(dirPath.filePath(urlDirName));
215 } 222 }
216 223
217 void 224 void
225 MultiChoiceDialog::fileChanged(const QString &s)
226 {
227 if (m_argTypes[m_currentChoice] == UrlToDirectoryArg) {
228 m_okButton->setEnabled(getArgument() != "" &&
229 getAdditionalArgument() != "");
230 } else {
231 m_okButton->setEnabled(getArgument() != "");
232 }
233 }
234
235 void
218 MultiChoiceDialog::choiceChanged() 236 MultiChoiceDialog::choiceChanged()
219 { 237 {
220 DEBUG << "choiceChanged" << endl; 238 DEBUG << "choiceChanged" << endl;
221 239
222 if (m_choiceButtons.empty()) return; 240 if (m_choiceButtons.empty()) return;
261 279
262 case NoArg: 280 case NoArg:
263 break; 281 break;
264 282
265 case FileArg: 283 case FileArg:
266 m_fileLabel->setText(tr("File:")); 284 m_fileLabel->setText(tr("&File:"));
267 m_fileLabel->show(); 285 m_fileLabel->show();
268 m_fileCombo->show(); 286 m_fileCombo->show();
269 m_fileCombo->addItems(rf->getRecent()); 287 m_fileCombo->addItems(rf->getRecent());
270 m_browseButton->show(); 288 m_browseButton->show();
271 break; 289 break;
272 290
273 case DirectoryArg: 291 case DirectoryArg:
274 m_fileLabel->setText(tr("Folder:")); 292 m_fileLabel->setText(tr("&Folder:"));
275 m_fileLabel->show(); 293 m_fileLabel->show();
276 m_fileCombo->show(); 294 m_fileCombo->show();
277 m_fileCombo->addItems(rf->getRecent()); 295 m_fileCombo->addItems(rf->getRecent());
278 m_browseButton->show(); 296 m_browseButton->show();
279 break; 297 break;
285 303
286 case UrlToDirectoryArg: 304 case UrlToDirectoryArg:
287 m_urlLabel->show(); 305 m_urlLabel->show();
288 m_urlCombo->show(); 306 m_urlCombo->show();
289 m_urlCombo->addItems(rf->getRecent()); 307 m_urlCombo->addItems(rf->getRecent());
290 m_fileLabel->setText(tr("Folder:")); 308 m_fileLabel->setText(tr("&Folder:"));
291 m_fileLabel->show(); 309 m_fileLabel->show();
292 m_fileCombo->show(); 310 m_fileCombo->show();
293 m_fileCombo->lineEdit()->setText(QDir::homePath()); 311 m_fileCombo->lineEdit()->setText(QDir::homePath());
294 m_browseButton->show(); 312 m_browseButton->show();
295 break; 313 break;