Changeset 14205
- Timestamp:
- Sep 14, 2013, 10:50:25 PM (9 years ago)
- Location:
- trunk/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/mainwin.cc
r14177 r14205 15 15 16 16 #include <QtGui> 17 #include <QCheckBox> 17 18 #include <QProxyStyle> 18 19 #include <QLabel> … … 107 108 myStatsDialog (new StatsDialog (session, this)), 108 109 myDetailsDialog (0), 109 myFileDialogOptionsCheck (0),110 110 myFilterModel (prefs), 111 111 myTorrentDelegate (new TorrentDelegate (this)), … … 1155 1155 ***/ 1156 1156 1157 #define SHOW_OPTIONS_CHECKBOX_NAME "show-options-checkbox" 1158 1157 1159 void 1158 1160 TrMainWindow :: newTorrent () … … 1165 1167 TrMainWindow :: openTorrent () 1166 1168 { 1167 QFileDialog * myFileDialog;1168 myFileDialog= new QFileDialog (this,1169 1170 1171 1172 myFileDialog->setFileMode (QFileDialog::ExistingFiles);1173 myFileDialog->setAttribute (Qt::WA_DeleteOnClose);1174 1175 QCheckBox * b utton= new QCheckBox (tr ("Show &options dialog"));1176 b utton->setChecked (myPrefs.getBool (Prefs::OPTIONS_PROMPT));1177 QGridLayout * layout = dynamic_cast<QGridLayout*> (myFileDialog->layout ());1178 layout->addWidget (button, layout->rowCount (), 0, 1, -1, Qt::AlignLeft);1179 myFileDialogOptionsCheck = button;1180 1181 connect ( myFileDialog, SIGNAL (filesSelected (const QStringList&)),1169 QFileDialog * d; 1170 d = new QFileDialog (this, 1171 tr ("Open Torrent"), 1172 myPrefs.getString (Prefs::OPEN_DIALOG_FOLDER), 1173 tr ("Torrent Files (*.torrent);;All Files (*.*)")); 1174 d->setFileMode (QFileDialog::ExistingFiles); 1175 d->setAttribute (Qt::WA_DeleteOnClose); 1176 1177 QCheckBox * b = new QCheckBox (tr ("Show &options dialog")); 1178 b->setChecked (myPrefs.getBool (Prefs::OPTIONS_PROMPT)); 1179 b->setObjectName (SHOW_OPTIONS_CHECKBOX_NAME); 1180 QGridLayout * l = dynamic_cast<QGridLayout*> (d->layout ()); 1181 l->addWidget (b, l->rowCount (), 0, 1, -1, Qt::AlignLeft); 1182 1183 connect (d, SIGNAL (filesSelected (const QStringList&)), 1182 1184 this, SLOT (addTorrents (const QStringList&))); 1183 1185 1184 myFileDialog->show ();1186 d->show (); 1185 1187 } 1186 1188 … … 1196 1198 str.clear (); 1197 1199 1198 addTorrent (str );1200 addTorrent (str, true); 1199 1201 } 1200 1202 … … 1202 1204 TrMainWindow :: addTorrents (const QStringList& filenames) 1203 1205 { 1206 bool showOptions = myPrefs.getBool (Prefs::OPTIONS_PROMPT); 1207 1208 const QFileDialog * const fileDialog = qobject_cast<const QFileDialog*> (sender ()); 1209 if (fileDialog != NULL) 1210 { 1211 const QCheckBox * const b = fileDialog->findChild<const QCheckBox*> (SHOW_OPTIONS_CHECKBOX_NAME); 1212 if (b != NULL) 1213 showOptions = b->isChecked (); 1214 } 1215 1204 1216 foreach (const QString& filename, filenames) 1205 addTorrent (filename); 1206 } 1207 1208 void 1209 TrMainWindow :: addTorrent (const AddData& addMe) 1210 { 1211 bool show_options_dialog; 1212 1213 if (myFileDialogOptionsCheck) 1214 show_options_dialog = myFileDialogOptionsCheck->isChecked (); 1215 else 1216 show_options_dialog = myPrefs.getBool (Prefs::OPTIONS_PROMPT); 1217 1218 if (show_options_dialog) 1217 addTorrent (filename, showOptions); 1218 } 1219 1220 void 1221 TrMainWindow :: addTorrent (const AddData& addMe, bool showOptions) 1222 { 1223 if (showOptions) 1219 1224 { 1220 1225 Options * o = new Options (mySession, myPrefs, addMe, this); -
trunk/qt/mainwin.h
r14176 r14205 15 15 16 16 #include <ctime> 17 #include <QCheckBox>18 17 #include <QLineEdit> 19 18 #include <QIcon> … … 65 64 QDialog * myStatsDialog; 66 65 Details * myDetailsDialog; 67 QCheckBox * myFileDialogOptionsCheck;68 66 QSystemTrayIcon myTrayIcon; 69 67 TorrentFilter myFilterModel; … … 173 171 void queueMoveBottom (); 174 172 void reannounceSelected (); 175 void addTorrent (const AddData& addMe);176 173 void onNetworkTimer (); 177 174 178 175 private: 179 176 void clearSelection (); 177 void addTorrent (const AddData& addMe, bool showOptions); 180 178 181 179 public slots:
Note: See TracChangeset
for help on using the changeset viewer.