[LyX/master] FindAdv: Amend d09f5ce1: Added new debug level :findverbose

Kornel Benko kornel at lyx.org
Sun Apr 24 10:52:56 UTC 2022


commit 3b7a79f137a09a68f9d1febfaacf5bf3dc07fe2d
Author: Kornel Benko <kornel at lyx.org>
Date:   Sun Apr 24 13:27:36 2022 +0200

    FindAdv: Amend d09f5ce1: Added new debug level :findverbose
    
    Fix the GUI handling for the new value using now 'unsigned long long' instead of 'int'
---
 src/frontends/qt/GuiProgressView.cpp |   11 ++++++-----
 src/support/debug.cpp                |    2 +-
 src/support/debug.h                  |    7 +++++--
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/frontends/qt/GuiProgressView.cpp b/src/frontends/qt/GuiProgressView.cpp
index 6c5f939..c44704b 100644
--- a/src/frontends/qt/GuiProgressView.cpp
+++ b/src/frontends/qt/GuiProgressView.cpp
@@ -51,7 +51,7 @@ GuiProgressView::~GuiProgressView()
 
 
 namespace{
-typedef pair<int, QString> DebugMap;
+typedef pair<unsigned long long, QString> DebugMap;
 typedef vector<DebugMap> DebugVector;
 
 bool DebugSorter(DebugMap const & a, DebugMap const & b)
@@ -106,7 +106,7 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
 	for (; dit != den; ++dit) {
 		QTreeWidgetItem * item = new QTreeWidgetItem(widget_->debugMessagesTW);
 		item->setText(0, dit->second);
-		item->setData(0, Qt::UserRole, int(dit->first));
+		item->setData(0, Qt::UserRole, dit->first);
 		item->setText(1, qt_("No"));
 	}
 	widget_->debugMessagesTW->resizeColumnToContents(0);
@@ -152,11 +152,12 @@ void GuiProgressView::debugMessageActivated(QTreeWidgetItem * item, int)
 
 void GuiProgressView::levelChanged()
 {
-	unsigned int level = Debug::NONE;
+	unsigned long long level = Debug::NONE;
 	QTreeWidgetItemIterator it(widget_->debugMessagesTW);
 	while (*it) {
-		if ((*it)->text(1) == qt_("Yes"))
-			level |= (*it)->data(0, Qt::UserRole).toInt();
+		if ((*it)->text(1) == qt_("Yes")) {
+			level |= (*it)->data(0, Qt::UserRole).toULongLong();
+		}
 		++it;
 	}
 	dispatch(FuncRequest(LFUN_DEBUG_LEVEL_SET, convert<string>(level)));
diff --git a/src/support/debug.cpp b/src/support/debug.cpp
index 04485be..fa40d59 100644
--- a/src/support/debug.cpp
+++ b/src/support/debug.cpp
@@ -129,7 +129,7 @@ Debug::Type Debug::value(string const & val)
 			break;
 		// Is it a number?
 		if (isStrInt(tmp))
-			l |= static_cast<Type>(convert<int>(tmp));
+			l |= static_cast<Type>(convert<unsigned long long>(tmp));
 		else
 			// Search for an explicit name
 			for (DebugErrorItem const & item : errorTags)
diff --git a/src/support/debug.h b/src/support/debug.h
index 681ef3f..2306524 100644
--- a/src/support/debug.h
+++ b/src/support/debug.h
@@ -32,12 +32,15 @@ typedef basic_streambuf<char, char_traits<char> > streambuf;
 #endif
 
 
+// Make sure at compile time that sizeof(unsigned long long) >= 8
+typedef char p__LINE__[ (sizeof(unsigned long long) > 7) ? 1 : -1];
+
 namespace lyx {
 
 ///  This is all the different debug levels that we have.
 namespace Debug {
 	///
-	typedef uint64_t base_type;
+	typedef unsigned long long base_type;
 	enum Type : base_type {
 		///
 		NONE = 0,
@@ -106,7 +109,7 @@ namespace Debug {
 		///
 		FINDVERBOSE= (1u << 31),
 		///
-		DEBUG      = (1L << 32),
+		DEBUG      = (1ULL << 32),
 		///
 		ANY = 0x1ffffffff
 	};


More information about the lyx-cvs mailing list