mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
no stl includes in debug.h
change Debug API git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32675 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0a6118f0c7
commit
75f6ced64b
@ -957,7 +957,7 @@ int parse_dbg(string const & arg, string const &, string &)
|
||||
}
|
||||
lyxerr << to_utf8(bformat(_("Setting debug level to %1$s"), from_utf8(arg))) << endl;
|
||||
|
||||
lyxerr.level(Debug::value(arg));
|
||||
lyxerr.setLevel(Debug::value(arg));
|
||||
Debug::showLevel(lyxerr, lyxerr.level());
|
||||
return 1;
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_DEBUG_LEVEL_SET:
|
||||
lyxerr.level(Debug::value(to_utf8(cmd.argument())));
|
||||
lyxerr.setLevel(Debug::value(to_utf8(cmd.argument())));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -62,15 +62,16 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
|
||||
widget_->outTE->setFont(font);
|
||||
|
||||
|
||||
const std::vector<Debug::Type> levels = Debug::levels();
|
||||
for (unsigned int i = 1; i < levels.size(); i++) {
|
||||
LevelButton * box = new LevelButton(toqstr(Debug::description(levels[i])));
|
||||
box->level = levels[i];
|
||||
const int levelCount = Debug::levelCount();
|
||||
for (int i = 0; i < levelCount; i++) {
|
||||
const Debug::Type level = Debug::value(i);
|
||||
LevelButton * box = new LevelButton(toqstr(Debug::description(level)));
|
||||
box->level = level;
|
||||
widget_->settingsLayout->addWidget(box);
|
||||
// TODO settings
|
||||
box->setChecked(false);
|
||||
level_buttons << box;
|
||||
connect(box, SIGNAL(stateChanged(int)), this, SLOT(levelChange()));
|
||||
connect(box, SIGNAL(stateChanged(int)), this, SLOT(levelChanged()));
|
||||
}
|
||||
|
||||
|
||||
@ -92,9 +93,15 @@ void GuiProgressView::levelChanged()
|
||||
int level = Debug::NONE;
|
||||
Q_FOREACH(const LevelButton* button, level_buttons) {
|
||||
if (button->isChecked())
|
||||
level |= button->level;
|
||||
// Debug::NONE overwrites other levels
|
||||
if (button->level == Debug::NONE) {
|
||||
lyxerr.setLevel(Debug::NONE);
|
||||
return;
|
||||
} else {
|
||||
level |= button->level;
|
||||
}
|
||||
}
|
||||
lyxerr.level(static_cast<Debug::Type>(level));
|
||||
lyxerr.setLevel(static_cast<Debug::Type>(level));
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,15 +79,20 @@ int const numErrorTags = sizeof(errorTags)/sizeof(errorTags[0]);
|
||||
} // namespace anon
|
||||
|
||||
|
||||
const std::vector<Debug::Type> Debug::levels()
|
||||
int Debug::levelCount()
|
||||
{
|
||||
std::vector<Debug::Type> vec;
|
||||
for (int i = 0 ; i < numErrorTags ; ++i) {
|
||||
vec.push_back(errorTags[i].level);
|
||||
}
|
||||
return vec;
|
||||
return numErrorTags;
|
||||
}
|
||||
|
||||
|
||||
Debug::Type Debug::value(int idx)
|
||||
{
|
||||
if (idx > 0 && idx < numErrorTags)
|
||||
return errorTags[idx].level;
|
||||
return Debug::NONE;
|
||||
}
|
||||
|
||||
|
||||
string const Debug::description(Debug::Type val)
|
||||
{
|
||||
for (int i = 0 ; i < numErrorTags ; ++i) {
|
||||
|
@ -20,7 +20,6 @@
|
||||
#define LYXDEBUG_H
|
||||
|
||||
#include "support/strfwd.h"
|
||||
#include <vector>
|
||||
|
||||
namespace std {
|
||||
|
||||
@ -108,13 +107,20 @@ namespace Debug {
|
||||
ANY = 0xffffffff
|
||||
};
|
||||
|
||||
const std::vector<Type> levels();
|
||||
|
||||
// Return number of levels
|
||||
int levelCount();
|
||||
|
||||
|
||||
/** A function to convert symbolic string names on debug levels
|
||||
to their numerical value.
|
||||
*/
|
||||
Type value(std::string const & val);
|
||||
|
||||
/** A function to convert index of level to their numerical value.
|
||||
*/
|
||||
Type value(int val);
|
||||
|
||||
/// Return description of level
|
||||
std::string const description(Type val);
|
||||
|
||||
@ -158,7 +164,7 @@ public:
|
||||
/// Sets stream
|
||||
std::ostream & stream() { return *stream_; }
|
||||
/// Sets the debug level to t.
|
||||
void level(Debug::Type t) { dt = t; }
|
||||
void setLevel(Debug::Type t) { dt = t; }
|
||||
/// Returns the current debug level.
|
||||
Debug::Type level() const { return dt; }
|
||||
/// Returns stream
|
||||
|
Loading…
Reference in New Issue
Block a user