comparison confirmcommentdialog.cpp @ 298:fd9dc5a457d8

* Make "More Details" button non-auto-default in more-info dialog * Make Incoming dialog show same message as in Pull dialog when no changes are pending * Try to make the confirm-push/pull dialogs look more in-keeping on OS/X... but mostly we end up making their text too small. Hmm.
author Chris Cannam
date Tue, 22 Feb 2011 15:12:56 +0000
parents 1244dc3107cb
children
comparison
equal deleted inserted replaced
295:01a471e9cbe3 298:fd9dc5a457d8
71 } 71 }
72 72
73 QString ConfirmCommentDialog::buildFilesText(QString intro, QStringList files) 73 QString ConfirmCommentDialog::buildFilesText(QString intro, QStringList files)
74 { 74 {
75 QString text; 75 QString text;
76 text = "<qt>" + intro; 76
77 text += "<p><code>"; 77 if (intro == "") text = "<qt>";
78 else text = "<qt>" + intro + "<p>";
79
80 text += "<code>";
78 foreach (QString file, files) { 81 foreach (QString file, files) {
79 text += "&nbsp;&nbsp;&nbsp;" + xmlEncode(file) + "<br>"; 82 text += "&nbsp;&nbsp;&nbsp;" + xmlEncode(file) + "<br>";
80 } 83 }
81 text += "</code></qt>"; 84 text += "</code></qt>";
85
82 return text; 86 return text;
83 } 87 }
84 88
85 bool ConfirmCommentDialog::confirm(QWidget *parent, 89 bool ConfirmCommentDialog::confirm(QWidget *parent,
86 QString title, 90 QString title,
91 QString head,
87 QString text, 92 QString text,
88 QString okButtonText) 93 QString okButtonText)
89 { 94 {
90 QMessageBox box(QMessageBox::Question, 95 QMessageBox box(QMessageBox::Question,
91 title, 96 title,
92 text, 97 head,
93 QMessageBox::Cancel, 98 QMessageBox::Cancel,
94 parent); 99 parent);
100
101 box.setInformativeText(text);
95 102
96 QPushButton *ok = box.addButton(QMessageBox::Ok); 103 QPushButton *ok = box.addButton(QMessageBox::Ok);
97 ok->setText(okButtonText); 104 ok->setText(okButtonText);
98 box.setDefaultButton(QMessageBox::Ok); 105 box.setDefaultButton(QMessageBox::Ok);
99 if (box.exec() == -1) return false; 106 if (box.exec() == -1) return false;
100 return box.standardButton(box.clickedButton()) == QMessageBox::Ok; 107 return box.standardButton(box.clickedButton()) == QMessageBox::Ok;
101 } 108 }
102 109
103 bool ConfirmCommentDialog::confirmDangerous(QWidget *parent, 110 bool ConfirmCommentDialog::confirmDangerous(QWidget *parent,
104 QString title, 111 QString title,
112 QString head,
105 QString text, 113 QString text,
106 QString okButtonText) 114 QString okButtonText)
107 { 115 {
108 QMessageBox box(QMessageBox::Warning, 116 QMessageBox box(QMessageBox::Warning,
109 title, 117 title,
110 text, 118 head,
111 QMessageBox::Cancel, 119 QMessageBox::Cancel,
112 parent); 120 parent);
121
122 box.setInformativeText(text);
113 123
114 QPushButton *ok = box.addButton(QMessageBox::Ok); 124 QPushButton *ok = box.addButton(QMessageBox::Ok);
115 ok->setText(okButtonText); 125 ok->setText(okButtonText);
116 box.setDefaultButton(QMessageBox::Cancel); 126 box.setDefaultButton(QMessageBox::Cancel);
117 if (box.exec() == -1) return false; 127 if (box.exec() == -1) return false;
129 if (files.size() <= 10) { 139 if (files.size() <= 10) {
130 text = buildFilesText(introText, files); 140 text = buildFilesText(introText, files);
131 } else { 141 } else {
132 text = "<qt>" + introTextWithCount + "</qt>"; 142 text = "<qt>" + introTextWithCount + "</qt>";
133 } 143 }
134 return confirm(parent, title, text, okButtonText); 144 return confirm(parent, title, text, "", okButtonText);
135 } 145 }
136 146
137 bool ConfirmCommentDialog::confirmDangerousFilesAction(QWidget *parent, 147 bool ConfirmCommentDialog::confirmDangerousFilesAction(QWidget *parent,
138 QString title, 148 QString title,
139 QString introText, 149 QString introText,
145 if (files.size() <= 10) { 155 if (files.size() <= 10) {
146 text = buildFilesText(introText, files); 156 text = buildFilesText(introText, files);
147 } else { 157 } else {
148 text = "<qt>" + introTextWithCount + "</qt>"; 158 text = "<qt>" + introTextWithCount + "</qt>";
149 } 159 }
150 return confirmDangerous(parent, title, text, okButtonText); 160 return confirmDangerous(parent, title, text, "", okButtonText);
151 } 161 }
152 162
153 bool ConfirmCommentDialog::confirmAndGetShortComment(QWidget *parent, 163 bool ConfirmCommentDialog::confirmAndGetShortComment(QWidget *parent,
154 QString title, 164 QString title,
155 QString introText, 165 QString introText,