Changeset 121 for smplayer/vendor/current/src/filechooser.cpp
- Timestamp:
- Mar 15, 2012, 5:14:10 PM (14 years ago)
- File:
-
- 1 edited
-
smplayer/vendor/current/src/filechooser.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/filechooser.cpp
r118 r121 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 1 Ricardo Villalba <[email protected]>2 Copyright (C) 2006-201> 3 3 4 4 This program is free software; you can redistribute it and/or modify … … 18 18 19 19 #include "filechooser.h" 20 21 20 22 21 23 //#define NO_SMPLAYER_SUPPORT … … 28 30 #endif 29 31 30 FileChooser::FileChooser(QWidget * parent) : QWidget(parent) 32 QString FileChooser::last_dir; 33 34 FileChooser::FileChooser(QWidget * parent) : LineEditWithIcon(parent) 31 35 { 32 setupUi(this);33 34 #ifndef NO_SMPLAYER_SUPPORT35 button->setIcon(Images::icon("find"));36 #else37 button->setIcon(QIcon(":/find"));38 #endif39 40 36 setDialogType(GetFileName); 41 37 setOptions(0); 38 39 40 41 42 42 43 } 43 44 … … 45 46 } 46 47 47 QLineEdit * FileChooser::lineEdit() { 48 return line_edit; 48 void FileChooser::setupButton() { 49 #ifdef NO_SMPLAYER_SUPPORT 50 setIcon( QPixmap(":/folder_open") ); 51 #else 52 setIcon( Images::icon("folder_open") ); 53 #endif 54 button->setToolTip( tr("Click to select a file or folder") ); 49 55 } 50 56 51 QToolButton * FileChooser::toolButton() { 52 return button; 53 } 57 void FileChooser::openFileDialog() { 58 qDebug("FileChooser::openFileDialog"); 54 59 55 QString FileChooser::text() const {56 return line_edit->text();57 }58 59 void FileChooser::setText(const QString & text) {60 line_edit->setText(text);61 }62 63 void FileChooser::on_button_clicked() {64 60 QString result; 65 61 QString f; … … 69 65 if (opts == 0) opts = QFileDialog::DontResolveSymlinks; 70 66 67 68 69 70 71 71 #ifndef NO_SMPLAYER_SUPPORT 72 72 result = MyFileDialog::getOpenFileName( … … 75 75 #endif 76 76 this, caption(), 77 line_edit->text(),77 , 78 78 filter(), &f, opts ); 79 79 80 } 80 81 else … … 82 83 QFileDialog::Options opts = options(); 83 84 if (opts == 0) opts = QFileDialog::ShowDirsOnly; 85 86 87 88 84 89 85 90 #ifndef NO_SMPLAYER_SUPPORT … … 89 94 #endif 90 95 this, caption(), 91 line_edit->text(), opts ); 96 dir, opts ); 97 if (!result.isEmpty()) last_dir = result; 92 98 } 93 99 94 100 if (!result.isEmpty()) { 95 QString old_file = line_edit->text();96 line_edit->setText(result);101 QString old_file = text(); 102 setText(result); 97 103 if (old_file != result) emit fileChanged(result); 98 104 } … … 100 106 101 107 #include "moc_filechooser.cpp" 102
Note:
See TracChangeset
for help on using the changeset viewer.
