comparison widgets/InteractiveFileFinder.cpp @ 831:831188672987

Make it possible to set the parent widget
author Chris Cannam
date Wed, 13 Aug 2014 16:42:25 +0100
parents 9c272d39c3e3
children c02c51ae5238 a429b2acb45d
comparison
equal deleted inserted replaced
830:8bb9320f78a4 831:831188672987
32 InteractiveFileFinder 32 InteractiveFileFinder
33 InteractiveFileFinder::m_instance; 33 InteractiveFileFinder::m_instance;
34 34
35 InteractiveFileFinder::InteractiveFileFinder() : 35 InteractiveFileFinder::InteractiveFileFinder() :
36 m_sessionExtension("sv"), 36 m_sessionExtension("sv"),
37 m_lastLocatedLocation("") 37 m_lastLocatedLocation(""),
38 m_parent(0)
38 { 39 {
39 SVDEBUG << "Registering interactive file finder" << endl; 40 SVDEBUG << "Registering interactive file finder" << endl;
40 FileFinder::registerFileFinder(this); 41 FileFinder::registerFileFinder(this);
41 } 42 }
42 43
43 InteractiveFileFinder::~InteractiveFileFinder() 44 InteractiveFileFinder::~InteractiveFileFinder()
44 { 45 {
46 }
47
48 void
49 InteractiveFileFinder::setParentWidget(QWidget *parent)
50 {
51 getInstance()->m_parent = parent;
45 } 52 }
46 53
47 void 54 void
48 InteractiveFileFinder::setApplicationSessionExtension(QString extension) 55 InteractiveFileFinder::setApplicationSessionExtension(QString extension)
49 { 56 {
160 167
161 QString path = ""; 168 QString path = "";
162 169
163 // Use our own QFileDialog just for symmetry with getSaveFileName below 170 // Use our own QFileDialog just for symmetry with getSaveFileName below
164 171
165 QFileDialog dialog; 172 QFileDialog dialog(m_parent);
166 dialog.setNameFilters(filter.split('\n')); 173 dialog.setNameFilters(filter.split('\n'));
167 dialog.setWindowTitle(title); 174 dialog.setWindowTitle(title);
168 dialog.setDirectory(lastPath); 175 dialog.setDirectory(lastPath);
169 176
170 dialog.setAcceptMode(QFileDialog::AcceptOpen); 177 dialog.setAcceptMode(QFileDialog::AcceptOpen);
304 QString path = ""; 311 QString path = "";
305 312
306 // Use our own QFileDialog instead of static functions, as we may 313 // Use our own QFileDialog instead of static functions, as we may
307 // need to adjust the file extension based on the selected filter 314 // need to adjust the file extension based on the selected filter
308 315
309 QFileDialog dialog; 316 QFileDialog dialog(m_parent);
310 317
311 QStringList filters = filter.split('\n'); 318 QStringList filters = filter.split('\n');
312 319
313 dialog.setNameFilters(filters); 320 dialog.setNameFilters(filters);
314 dialog.setWindowTitle(title); 321 dialog.setWindowTitle(title);