mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-29 10:14:06 +02:00
Replaced every message output by calls to the log macros.
This commit is contained in:
parent
7d0c0e958c
commit
7c9364780b
11
src/cpu.cpp
11
src/cpu.cpp
@ -1,11 +1,14 @@
|
|||||||
#include "cpu.h"
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
#define SYSFS_CPUFREQ_DIR "/sys/devices/system/cpu/cpu0/cpufreq"
|
#define SYSFS_CPUFREQ_DIR "/sys/devices/system/cpu/cpu0/cpufreq"
|
||||||
#define SYSFS_CPUFREQ_MAX SYSFS_CPUFREQ_DIR "/scaling_max_freq"
|
#define SYSFS_CPUFREQ_MAX SYSFS_CPUFREQ_DIR "/scaling_max_freq"
|
||||||
#define SYSFS_CPUFREQ_SET SYSFS_CPUFREQ_DIR "/scaling_setspeed"
|
#define SYSFS_CPUFREQ_SET SYSFS_CPUFREQ_DIR "/scaling_setspeed"
|
||||||
@ -14,11 +17,11 @@ void writeStringToFile(const char *path, const char *content)
|
|||||||
{
|
{
|
||||||
int fd = open(path, O_RDWR);
|
int fd = open(path, O_RDWR);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
fprintf(stderr, "Failed to open \"%s\": %s\n", path, strerror(errno));
|
WARNING("Failed to open '%s': %s\n", path, strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
ssize_t written = write(fd, content, strlen(content));
|
ssize_t written = write(fd, content, strlen(content));
|
||||||
if (written == -1) {
|
if (written == -1) {
|
||||||
fprintf(stderr, "Error writing \"%s\": %s\n", path, strerror(errno));
|
WARNING("Error writing '%s': %s\n", path, strerror(errno));
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "filelister.h"
|
#include "filelister.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ void FileLister::browse()
|
|||||||
if (showDirectories || showFiles) {
|
if (showDirectories || showFiles) {
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
if ((dirp = opendir(path.c_str())) == NULL) {
|
if ((dirp = opendir(path.c_str())) == NULL) {
|
||||||
cout << "Error: opendir(" << path << ")" << endl;
|
ERROR("Error: opendir(%s)\n", path.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ void FileLister::browse()
|
|||||||
filepath = path + file;
|
filepath = path + file;
|
||||||
int statRet = stat(filepath.c_str(), &st);
|
int statRet = stat(filepath.c_str(), &st);
|
||||||
if (statRet == -1) {
|
if (statRet == -1) {
|
||||||
cout << "\033[0;34mGMENU2X:\033[0;31m stat failed on '" << filepath << "' with error '" << strerror(errno) << "'\033[0m" << endl;
|
ERROR("Stat failed on '%s' with error '%s'\n", filepath.c_str(), strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (find(excludes.begin(), excludes.end(), file) != excludes.end())
|
if (find(excludes.begin(), excludes.end(), file) != excludes.end())
|
||||||
|
@ -69,6 +69,8 @@
|
|||||||
#include "menusettingimage.h"
|
#include "menusettingimage.h"
|
||||||
#include "menusettingdir.h"
|
#include "menusettingdir.h"
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
#ifdef TARGET_PANDORA
|
#ifdef TARGET_PANDORA
|
||||||
@ -112,17 +114,15 @@ static const char *colorToString(enum color c)
|
|||||||
return colorNames[c];
|
return colorNames[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int /*argc*/, char */*argv*/[]) {
|
int main(int /*argc*/, char * /*argv*/[]) {
|
||||||
cout << "----" << endl;
|
INFO("----\nGMenu2X starting: If you read this message in the logs, check http://gmenu2x.sourceforge.net/page/Troubleshooting for a solution\n----\n");
|
||||||
cout << "GMenu2X starting: If you read this message in the logs, check http://gmenu2x.sourceforge.net/page/Troubleshooting for a solution" << endl;
|
|
||||||
cout << "----" << endl;
|
|
||||||
|
|
||||||
signal(SIGINT,&exit);
|
signal(SIGINT,&exit);
|
||||||
GMenu2X app;
|
GMenu2X app;
|
||||||
#ifdef DEBUG
|
|
||||||
cout << "Starting main()" << endl;
|
DEBUG("Starting main()\n");
|
||||||
#endif
|
|
||||||
app.main();
|
app.main();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ GMenu2X::GMenu2X() {
|
|||||||
|
|
||||||
//Screen
|
//Screen
|
||||||
if( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_JOYSTICK)<0 ) {
|
if( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_JOYSTICK)<0 ) {
|
||||||
cout << "\033[0;34mGMENU2X:\033[0;31m Could not initialize SDL:\033[0m " << SDL_GetError() << endl;
|
ERROR("Could not initialize SDL: %s\n", SDL_GetError());
|
||||||
quit();
|
quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,9 +288,8 @@ GMenu2X::GMenu2X() {
|
|||||||
initMenu();
|
initMenu();
|
||||||
|
|
||||||
if (!fileExists(confStr["wallpaper"])) {
|
if (!fileExists(confStr["wallpaper"])) {
|
||||||
#ifdef DEBUG
|
DEBUG("Searching wallpaper\n");
|
||||||
cout << "Searching wallpaper" << endl;
|
|
||||||
#endif
|
|
||||||
FileLister fl("skins/"+confStr["skin"]+"/wallpapers",false,true);
|
FileLister fl("skins/"+confStr["skin"]+"/wallpapers",false,true);
|
||||||
fl.setFilter(".png,.jpg,.jpeg,.bmp");
|
fl.setFilter(".png,.jpg,.jpeg,.bmp");
|
||||||
fl.browse();
|
fl.browse();
|
||||||
@ -403,7 +402,7 @@ void GMenu2X::initFont() {
|
|||||||
|
|
||||||
string fontFile = sc.getSkinFilePath("imgs/font.png");
|
string fontFile = sc.getSkinFilePath("imgs/font.png");
|
||||||
if (fontFile.empty()) {
|
if (fontFile.empty()) {
|
||||||
cout << "Font png not found!" << endl;
|
ERROR("Font png not found!\n");
|
||||||
quit();
|
quit();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
@ -795,7 +794,7 @@ void GMenu2X::main() {
|
|||||||
uint sectionsCoordX = 24;
|
uint sectionsCoordX = 24;
|
||||||
SDL_Rect re = {0,0,0,0};
|
SDL_Rect re = {0,0,0,0};
|
||||||
bool helpDisplayed = false;
|
bool helpDisplayed = false;
|
||||||
#ifdef DEBUG
|
#ifdef WITH_DEBUG
|
||||||
//framerate
|
//framerate
|
||||||
long tickFPS = SDL_GetTicks();
|
long tickFPS = SDL_GetTicks();
|
||||||
int drawn_frames = 0;
|
int drawn_frames = 0;
|
||||||
@ -913,7 +912,7 @@ void GMenu2X::main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef WITH_DEBUG
|
||||||
//framerate
|
//framerate
|
||||||
drawn_frames++;
|
drawn_frames++;
|
||||||
if (tickNow-tickFPS>=1000) {
|
if (tickNow-tickFPS>=1000) {
|
||||||
@ -1031,7 +1030,7 @@ void GMenu2X::explorer() {
|
|||||||
|
|
||||||
//if execution continues then something went wrong and as we already called SDL_Quit we cannot continue
|
//if execution continues then something went wrong and as we already called SDL_Quit we cannot continue
|
||||||
//try relaunching gmenu2x
|
//try relaunching gmenu2x
|
||||||
fprintf(stderr, "Error executing selected application, re-launching gmenu2x\n");
|
ERROR("Error executing selected application, re-launching gmenu2x\n");
|
||||||
chdir(getExePath().c_str());
|
chdir(getExePath().c_str());
|
||||||
execlp("./gmenu2x", "./gmenu2x", NULL);
|
execlp("./gmenu2x", "./gmenu2x", NULL);
|
||||||
}
|
}
|
||||||
@ -1167,7 +1166,7 @@ void GMenu2X::setSkin(const string &skin, bool setWallpaper) {
|
|||||||
string line;
|
string line;
|
||||||
while (getline(skinconf, line, '\n')) {
|
while (getline(skinconf, line, '\n')) {
|
||||||
line = trim(line);
|
line = trim(line);
|
||||||
cout << "skinconf: " << line << endl;
|
DEBUG("skinconf: '%s'\n", line.c_str());
|
||||||
string::size_type pos = line.find("=");
|
string::size_type pos = line.find("=");
|
||||||
string name = trim(line.substr(0,pos));
|
string name = trim(line.substr(0,pos));
|
||||||
string value = trim(line.substr(pos+1,line.length()));
|
string value = trim(line.substr(pos+1,line.length()));
|
||||||
@ -1460,9 +1459,8 @@ void GMenu2X::editLink() {
|
|||||||
//G
|
//G
|
||||||
menu->selLinkApp()->setBacklight(linkBacklight);
|
menu->selLinkApp()->setBacklight(linkBacklight);
|
||||||
|
|
||||||
#ifdef DEBUG
|
INFO("New Section: '%s'\n", newSection.c_str());
|
||||||
cout << "New Section: " << newSection << endl;
|
|
||||||
#endif
|
|
||||||
//if section changed move file and update link->file
|
//if section changed move file and update link->file
|
||||||
if (oldSection!=newSection) {
|
if (oldSection!=newSection) {
|
||||||
vector<string>::const_iterator newSectionIndex = find(menu->getSections().begin(),menu->getSections().end(),newSection);
|
vector<string>::const_iterator newSectionIndex = find(menu->getSections().begin(),menu->getSections().end(),newSection);
|
||||||
@ -1477,9 +1475,9 @@ void GMenu2X::editLink() {
|
|||||||
}
|
}
|
||||||
rename(menu->selLinkApp()->getFile().c_str(),newFileName.c_str());
|
rename(menu->selLinkApp()->getFile().c_str(),newFileName.c_str());
|
||||||
menu->selLinkApp()->renameFile(newFileName);
|
menu->selLinkApp()->renameFile(newFileName);
|
||||||
#ifdef DEBUG
|
|
||||||
cout << "New section index: " << newSectionIndex - menu->getSections().begin() << endl;
|
INFO("New section index: %i.\n", newSectionIndex - menu->getSections().begin());
|
||||||
#endif
|
|
||||||
menu->linkChangeSection(menu->selLinkIndex(), menu->selSectionIndex(), newSectionIndex - menu->getSections().begin());
|
menu->linkChangeSection(menu->selLinkIndex(), menu->selSectionIndex(), newSectionIndex - menu->getSections().begin());
|
||||||
}
|
}
|
||||||
menu->selLinkApp()->save();
|
menu->selLinkApp()->save();
|
||||||
@ -1816,7 +1814,7 @@ int GMenu2X::getVolume() {
|
|||||||
if(mixer)
|
if(mixer)
|
||||||
{
|
{
|
||||||
if (ioctl(mixer, SOUND_MIXER_READ_VOLUME, &basevolume) == -1) {
|
if (ioctl(mixer, SOUND_MIXER_READ_VOLUME, &basevolume) == -1) {
|
||||||
fprintf(stderr, "Failed opening mixer for read - VOLUME\n");
|
ERROR("Failed opening mixer for read - VOLUME\n");
|
||||||
}
|
}
|
||||||
close(mixer);
|
close(mixer);
|
||||||
if(basevolume != -1)
|
if(basevolume != -1)
|
||||||
@ -1833,7 +1831,7 @@ void GMenu2X::setVolume(int vol) {
|
|||||||
if(mixer)
|
if(mixer)
|
||||||
{
|
{
|
||||||
if (ioctl(mixer, SOUND_MIXER_WRITE_VOLUME, &oss_volume) == -1) {
|
if (ioctl(mixer, SOUND_MIXER_WRITE_VOLUME, &oss_volume) == -1) {
|
||||||
fprintf(stderr, "Failed opening mixer for write - VOLUME\n");
|
ERROR("Failed opening mixer for write - VOLUME\n");
|
||||||
}
|
}
|
||||||
close(mixer);
|
close(mixer);
|
||||||
}
|
}
|
||||||
@ -1887,7 +1885,7 @@ string GMenu2X::getDiskFree() {
|
|||||||
((unsigned long long)b.f_blocks * b.f_frsize) / 1048576;
|
((unsigned long long)b.f_blocks * b.f_frsize) / 1048576;
|
||||||
ss << free << "/" << total << "MB";
|
ss << free << "/" << total << "MB";
|
||||||
ss >> df;
|
ss >> df;
|
||||||
} else cout << "\033[0;34mGMENU2X:\033[0;31m statvfs failed with error '" << strerror(errno) << "'\033[0m" << endl;
|
} else WARNING("statvfs failed with error '%s'.\n", strerror(errno));
|
||||||
return df;
|
return df;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,10 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "inputmanager.h"
|
#include "inputmanager.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -41,14 +43,13 @@ void InputManager::init(const string &conffile) {
|
|||||||
for (int x=0; x<numJoy; x++) {
|
for (int x=0; x<numJoy; x++) {
|
||||||
SDL_Joystick *joy = SDL_JoystickOpen(x);
|
SDL_Joystick *joy = SDL_JoystickOpen(x);
|
||||||
if (joy) {
|
if (joy) {
|
||||||
#ifdef DEBUG
|
|
||||||
cout << "Initialized joystick: " << SDL_JoystickName(x) << endl;
|
INFO("Initialized joystick: '%s'\n", SDL_JoystickName(x));
|
||||||
#endif
|
|
||||||
joysticks.push_back(joy);
|
joysticks.push_back(joy);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
else cout << "Failed to initialize joystick: " << x << endl;
|
else WARNING("Failed to initialize joystick: %i\n", x);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setActionsCount(14);
|
setActionsCount(14);
|
||||||
|
@ -23,10 +23,12 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "linkapp.h"
|
#include "linkapp.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "selector.h"
|
#include "selector.h"
|
||||||
#include "textmanualdialog.h"
|
#include "textmanualdialog.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -100,7 +102,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, InputManager &inputMgr_,
|
|||||||
} else if (name == "selectoraliases") {
|
} else if (name == "selectoraliases") {
|
||||||
setAliasFile( value );
|
setAliasFile( value );
|
||||||
} else {
|
} else {
|
||||||
cout << "Unrecognized option: " << name << endl;
|
WARNING("Unrecognized option: '%s'\n", name.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +254,7 @@ bool LinkApp::save() {
|
|||||||
sync();
|
sync();
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
cout << "\033[0;34mGMENU2X:\033[0;31m Error while opening the file '" << file << "' for write\033[0m" << endl;
|
ERROR("Error while opening the file '%s' for write.\n", file.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,9 +438,7 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
|
|||||||
if (volume()>=0)
|
if (volume()>=0)
|
||||||
gmenu2x->setVolume(volume());
|
gmenu2x->setVolume(volume());
|
||||||
|
|
||||||
#ifdef DEBUG
|
INFO("Executing '%s' (%s %s)\n", title.c_str(), exec.c_str(), params.c_str());
|
||||||
cout << "\033[0;34mGMENU2X:\033[0m Executing '" << title << "' (" << exec << " " << params << ")" << endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//check if we have to quit
|
//check if we have to quit
|
||||||
string command = cmdclean(exec);
|
string command = cmdclean(exec);
|
||||||
|
33
src/menu.cpp
33
src/menu.cpp
@ -31,6 +31,7 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "filelister.h"
|
#include "filelister.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -207,9 +208,8 @@ bool Menu::addLink(string path, string file, string section) {
|
|||||||
linkpath = "sections/"+section+"/"+title+linkpath;
|
linkpath = "sections/"+section+"/"+title+linkpath;
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
cout << "\033[0;34mGMENU2X:\033[0m Adding link: " << linkpath << endl;
|
INFO("Adding link: '%s'\n", linkpath.c_str());
|
||||||
#endif
|
|
||||||
|
|
||||||
if (path[path.length()-1]!='/') path += "/";
|
if (path[path.length()-1]!='/') path += "/";
|
||||||
//search for a manual
|
//search for a manual
|
||||||
@ -241,9 +241,8 @@ bool Menu::addLink(string path, string file, string section) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
cout << "\033[0;34mGMENU2X:\033[0m Manual: " << manual << endl;
|
INFO("Manual: '%s'\n", manual.c_str());
|
||||||
#endif
|
|
||||||
|
|
||||||
string shorttitle=title, description="", exec=path+file, icon="";
|
string shorttitle=title, description="", exec=path+file, icon="";
|
||||||
|
|
||||||
@ -266,17 +265,17 @@ bool Menu::addLink(string path, string file, string section) {
|
|||||||
sync();
|
sync();
|
||||||
int isection = find(sections.begin(),sections.end(),section) - sections.begin();
|
int isection = find(sections.begin(),sections.end(),section) - sections.begin();
|
||||||
if (isection>=0 && isection<(int)sections.size()) {
|
if (isection>=0 && isection<(int)sections.size()) {
|
||||||
#ifdef DEBUG
|
|
||||||
cout << "\033[0;34mGMENU2X:\033[0m Section: " << sections[isection] << "(" << isection << ")" << endl;
|
INFO("Section: '%s(%i)'\n", sections[isection].c_str(), isection);
|
||||||
#endif
|
|
||||||
LinkApp* link = new LinkApp(gmenu2x, gmenu2x->input, linkpath.c_str());
|
LinkApp* link = new LinkApp(gmenu2x, gmenu2x->input, linkpath.c_str());
|
||||||
link->setSize(gmenu2x->skinConfInt["linkWidth"],gmenu2x->skinConfInt["linkHeight"]);
|
link->setSize(gmenu2x->skinConfInt["linkWidth"],gmenu2x->skinConfInt["linkHeight"]);
|
||||||
links[isection].push_back( link );
|
links[isection].push_back( link );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG
|
|
||||||
cout << "\033[0;34mGMENU2X:\033[0;31m Error while opening the file '" << linkpath << "' for write\033[0m" << endl;
|
ERROR("Error while opening the file '%s' for write.\n", linkpath.c_str());
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,9 +294,8 @@ bool Menu::addSection(const string §ionName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Menu::deleteSelectedLink() {
|
void Menu::deleteSelectedLink() {
|
||||||
#ifdef DEBUG
|
INFO("Deleting link '%s'\n", selLink()->getTitle().c_str());
|
||||||
cout << "\033[0;34mGMENU2X:\033[0m Deleting link " << selLink()->getTitle() << endl;
|
|
||||||
#endif
|
|
||||||
if (selLinkApp()!=NULL)
|
if (selLinkApp()!=NULL)
|
||||||
unlink(selLinkApp()->getFile().c_str());
|
unlink(selLinkApp()->getFile().c_str());
|
||||||
gmenu2x->sc.del(selLink()->getIconPath());
|
gmenu2x->sc.del(selLink()->getIconPath());
|
||||||
@ -306,9 +304,8 @@ void Menu::deleteSelectedLink() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Menu::deleteSelectedSection() {
|
void Menu::deleteSelectedSection() {
|
||||||
#ifdef DEBUG
|
INFO("Deleting section '%s'\n", selSection().c_str());
|
||||||
cout << "\033[0;34mGMENU2X:\033[0m Deleting section " << selSection() << endl;
|
|
||||||
#endif
|
|
||||||
gmenu2x->sc.del("sections/"+selSection()+".png");
|
gmenu2x->sc.del("sections/"+selSection()+".png");
|
||||||
links.erase( links.begin()+selSectionIndex() );
|
links.erase( links.begin()+selSectionIndex() );
|
||||||
sections.erase( sections.begin()+selSectionIndex() );
|
sections.erase( sections.begin()+selSectionIndex() );
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "selector.h"
|
#include "selector.h"
|
||||||
#include "filelister.h"
|
#include "filelister.h"
|
||||||
#include "gmenu2x.h"
|
#include "gmenu2x.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -157,7 +158,7 @@ int Selector::exec(int startSelection) {
|
|||||||
result = false;
|
result = false;
|
||||||
} else {
|
} else {
|
||||||
dir = dir.substr(0,p+1);
|
dir = dir.substr(0,p+1);
|
||||||
cout << dir << endl;
|
INFO("%s\n", dir.c_str());
|
||||||
selected = 0;
|
selected = 0;
|
||||||
firstElement = 0;
|
firstElement = 0;
|
||||||
prepare(&fl,&screens,&titles);
|
prepare(&fl,&screens,&titles);
|
||||||
@ -204,9 +205,9 @@ void Selector::prepare(FileLister *fl, vector<string> *screens, vector<string> *
|
|||||||
titles->at(i) = getAlias(noext);
|
titles->at(i) = getAlias(noext);
|
||||||
if (titles->at(i)=="")
|
if (titles->at(i)=="")
|
||||||
titles->at(i) = noext;
|
titles->at(i) = noext;
|
||||||
#ifdef DEBUG
|
|
||||||
cout << "\033[0;34mGMENU2X:\033[0m Searching for screen " << screendir << noext << ".png" << endl;
|
DEBUG("Searching for screen '%s%s.png'\n", screendir.c_str(), noext.c_str());
|
||||||
#endif
|
|
||||||
if (fileExists(screendir+noext+".png"))
|
if (fileExists(screendir+noext+".png"))
|
||||||
screens->at(i) = screendir+noext+".png";
|
screens->at(i) = screendir+noext+".png";
|
||||||
else if (fileExists(screendir+noext+".jpg"))
|
else if (fileExists(screendir+noext+".jpg"))
|
||||||
|
@ -76,11 +76,11 @@ void SFontPlus::initFont(SDL_Surface *font, const string &characters) {
|
|||||||
if (font==NULL) return;
|
if (font==NULL) return;
|
||||||
surface = font;
|
surface = font;
|
||||||
Uint32 pink = SDL_MapRGB(surface->format, 255,0,255);
|
Uint32 pink = SDL_MapRGB(surface->format, 255,0,255);
|
||||||
#ifdef _DEBUG
|
#ifdef DEBUG
|
||||||
bool utf8 = false;
|
bool utf8 = false;
|
||||||
for (uint x=0; x<characters.length(); x++) {
|
for (uint x=0; x<characters.length(); x++) {
|
||||||
if (!utf8) utf8 = (unsigned char)characters[x]>128;
|
if (!utf8) utf8 = (unsigned char)characters[x]>128;
|
||||||
if (utf8) printf("%d\n", (unsigned char)characters[x]);
|
if (utf8) DEBUG("%d\n", (unsigned char)characters[x]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ using namespace std;
|
|||||||
|
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
RGBAColor strtorgba(const string &strColor) {
|
RGBAColor strtorgba(const string &strColor) {
|
||||||
RGBAColor c = {0,0,0,255};
|
RGBAColor c = {0,0,0,255};
|
||||||
@ -131,14 +132,14 @@ void Surface::load(const string &img, bool alpha, const string &skin) {
|
|||||||
raw = SDL_DisplayFormat(buf);
|
raw = SDL_DisplayFormat(buf);
|
||||||
SDL_FreeSurface(buf);
|
SDL_FreeSurface(buf);
|
||||||
} else {
|
} else {
|
||||||
cout << "Couldn't load surface " << img << endl;
|
ERROR("Couldn't load surface '%s'\n", img.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Surface::lock() {
|
void Surface::lock() {
|
||||||
if ( SDL_MUSTLOCK(raw) && !locked ) {
|
if ( SDL_MUSTLOCK(raw) && !locked ) {
|
||||||
if ( SDL_LockSurface(raw) < 0 ) {
|
if ( SDL_LockSurface(raw) < 0 ) {
|
||||||
fprintf(stderr, "Can't lock surface: %s\n", SDL_GetError());
|
ERROR("Can't lock surface: '%s'\n", SDL_GetError());
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
locked = true;
|
locked = true;
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#include "surfacecollection.h"
|
#include "surfacecollection.h"
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using std::cout;
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ string SurfaceCollection::getSkinFilePath(const string &file) {
|
|||||||
void SurfaceCollection::debug() {
|
void SurfaceCollection::debug() {
|
||||||
SurfaceHash::iterator end = surfaces.end();
|
SurfaceHash::iterator end = surfaces.end();
|
||||||
for(SurfaceHash::iterator curr = surfaces.begin(); curr != end; curr++){
|
for(SurfaceHash::iterator curr = surfaces.begin(); curr != end; curr++){
|
||||||
cout << "key: " << curr->first << endl;
|
DEBUG("key: %i\n", curr->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,9 +67,8 @@ Surface *SurfaceCollection::add(Surface *s, const string &path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Surface *SurfaceCollection::add(const string &path, bool alpha) {
|
Surface *SurfaceCollection::add(const string &path, bool alpha) {
|
||||||
#ifdef DEBUG
|
DEBUG("Adding surface: '%s'\n", path.c_str());
|
||||||
cout << "Adding surface: " << path << endl;
|
|
||||||
#endif
|
|
||||||
if (exists(path)) del(path);
|
if (exists(path)) del(path);
|
||||||
string filePath = path;
|
string filePath = path;
|
||||||
|
|
||||||
@ -85,9 +84,7 @@ Surface *SurfaceCollection::add(const string &path, bool alpha) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Surface *SurfaceCollection::addSkinRes(const string &path, bool alpha) {
|
Surface *SurfaceCollection::addSkinRes(const string &path, bool alpha) {
|
||||||
#ifdef DEBUG
|
DEBUG("Adding skin surface: '%s'\n", path.c_str());
|
||||||
cout << "Adding skin surface: " << path << endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (path.empty()) return NULL;
|
if (path.empty()) return NULL;
|
||||||
if (exists(path)) del(path);
|
if (exists(path)) del(path);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "translator.h"
|
#include "translator.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -66,9 +67,8 @@ string Translator::translate(const string &term,const char *replacestr,...) {
|
|||||||
if (i != translations.end()) {
|
if (i != translations.end()) {
|
||||||
result = i->second;
|
result = i->second;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
else cout << "Untranslated string: " << term << endl;
|
else WARNING("Untranslated string: '%s'\n", term.c_str());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -73,9 +74,7 @@ bool rmtree(string path) {
|
|||||||
struct dirent *dptr;
|
struct dirent *dptr;
|
||||||
string filepath;
|
string filepath;
|
||||||
|
|
||||||
#ifdef DEBUG
|
DEBUG("RMTREE: '%s'\n", path.c_str());
|
||||||
cout << "RMTREE: " << path << endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((dirp = opendir(path.c_str())) == NULL) return false;
|
if ((dirp = opendir(path.c_str())) == NULL) return false;
|
||||||
if (path[path.length()-1]!='/') path += "/";
|
if (path[path.length()-1]!='/') path += "/";
|
||||||
|
@ -18,8 +18,11 @@
|
|||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "wallpaperdialog.h"
|
#include "wallpaperdialog.h"
|
||||||
#include "filelister.h"
|
#include "filelister.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -44,9 +47,8 @@ bool WallpaperDialog::exec()
|
|||||||
for (uint i=0; i<fl.getFiles().size(); i++)
|
for (uint i=0; i<fl.getFiles().size(); i++)
|
||||||
wallpapers.push_back(fl.getFiles()[i]);
|
wallpapers.push_back(fl.getFiles()[i]);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
cout << "Wallpapers: " << wallpapers.size() << endl;
|
DEBUG("Wallpapers: %i\n", wallpapers.size());
|
||||||
#endif
|
|
||||||
|
|
||||||
uint i, selected = 0, firstElement = 0, iY;
|
uint i, selected = 0, firstElement = 0, iY;
|
||||||
while (!close) {
|
while (!close) {
|
||||||
|
Loading…
Reference in New Issue
Block a user