Root/
Source at commit d4490ba created 13 years 10 months ago. By Lars-Peter Clausen, remove redundant assignments | |
---|---|
1 | /*************************************************************************** |
2 | * Copyright (C) 2006 by Massimiliano Torromeo * |
3 | * massimiliano.torromeo@gmail.com * |
4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * |
6 | * it under the terms of the GNU General Public License as published by * |
7 | * the Free Software Foundation; either version 2 of the License, or * |
8 | * (at your option) any later version. * |
9 | * * |
10 | * This program is distributed in the hope that it will be useful, * |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
13 | * GNU General Public License for more details. * |
14 | * * |
15 | * You should have received a copy of the GNU General Public License * |
16 | * along with this program; if not, write to the * |
17 | * Free Software Foundation, Inc., * |
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
19 | ***************************************************************************/ |
20 | |
21 | #include <SDL.h> |
22 | #include <SDL_gfxPrimitives.h> |
23 | |
24 | //for browsing the filesystem |
25 | #include <sys/stat.h> |
26 | #include <sys/types.h> |
27 | #include <dirent.h> |
28 | |
29 | #include "imagedialog.h" |
30 | #include "filelister.h" |
31 | |
32 | using namespace std; |
33 | |
34 | ImageDialog::ImageDialog(GMenu2X *gmenu2x, const string &text, const string &filter, const string &file) : FileDialog(gmenu2x, text, filter, file) { |
35 | this->text = text; |
36 | this->filter = filter; |
37 | setPath("/card"); |
38 | title = "Image Browser"; |
39 | if (!file.empty()) { |
40 | this->file = strreplace(file,"skin:",gmenu2x->getExePath()+"skins/"+gmenu2x->confStr["skin"]+"/"); |
41 | string::size_type pos = this->file.rfind("/"); |
42 | if (pos != string::npos) { |
43 | setPath( this->file.substr(0, pos) ); |
44 | cout << "ib: " << path() << endl; |
45 | this->file = this->file.substr(pos+1,file.length()); |
46 | } |
47 | } |
48 | selRow = 0; |
49 | } |
50 | |
51 | ImageDialog::~ImageDialog() { |
52 | previews.clear(); |
53 | } |
54 | |
55 | void ImageDialog::beforeFileList() { |
56 | if (fl.isFile(selected) && fileExists(path()+"/"+fl[selected])) |
57 | previews[path()+"/"+fl[selected]]->blitRight(gmenu2x->s, 310, 43); |
58 | } |
59 | |
60 | void ImageDialog::onChangeDir() { |
61 | previews.clear(); |
62 | } |
63 |
Branches:
install_locations
master
opkrun
packages