diff --git a/bin/app/data/color_schemes/dark.xml b/bin/app/data/color_schemes/dark.xml new file mode 100644 index 00000000..3d59fbcc --- /dev/null +++ b/bin/app/data/color_schemes/dark.xml @@ -0,0 +1,413 @@ + + + + + #272728 + + + + + #F7F7F7 + #777777 + #555555 + + + + #F7F7F7 + #A0A0A0 + #272728 + #555555 + + + + + + + + + + + + + + + + + + + + + + + + + #2F2F2F + #F7F7F7 + + + black + #F7F7F7 + + + + + #406D4D + #F7F7F7 + + + #4E855E + #F7F7F7 + + + + + #7D2724 + #F7F7F7 + + + #8C2B29 + #F7F7F7 + + + + + #207EA8 + #F7F7F7 + + + #006D93 + #F7F7F7 + + + + + + + #272728 + + + #777777 + + + <text>#F7F7F7</text> + <normal>#777777</normal> + <hover>#555555</hover> + <press>#444444</press> + <icon>white</icon> + + + + #F7F7F7 + #272728 + + + + + #272728 + + + <text>#A0A0A0</text> + <background>transparent</background> + <hover>#2F2F2F</hover> + + + + #F7F7F7 + #A0A0A0 + #272728 + #969696 + + + + #F7F7F7 + #1F9C62 + #1F9C62 + #D95233 + #A0A0A4 + #CC3463 + #9368AD + #D69C36 + + + + white + #777777 + + + + + + transparent + transparent + + + #F7F7F7 + transparent + + + transparent + #F7F7F7 + #272728 + + + + + transparent + transparent + + + #A0A0A0 + #969696 + #191919 + + + transparent + #969696 + #272728 + + + + + transparent + transparent + + + + + transparent + #A0FF0000 + #000000 + + + #FFFF0000 + + + + + #207EA8 + #F7F7F7 + + + #006D93 + #134B63 + + + + + + + + #272728 + + + + + #4D4D4D + + + #C3C3C3 + + + #F7F7F7 + + + #F7F7F7 + + + #272728 + + + + + + #20C3C3C3 + #C3C3C3 + + + + type + + + type + + + type + + + type + + + type + + + type + + + type + + + type + + + + + #7A681F + #9C8528 + + + transparent + #C3C3C3 + + + + function + + + + + #21516B + #2A6484 + + + transparent + #C3C3C3 + + + + global_variable + + + global_variable> + + + + type + + + + #78282D + + + #80C3C3C3 + #C3C3C3 + + + + namespace + + + + + #1B564E + #247368 + + + #20C3C3C3 + #C3C3C3 + + + + file + + + + + #272728 + + + + + #272728 + + + #80C3C3C3 + #C3C3C3 + + + + + #272728 + + + #C3C3C3 + + + #F7F7F7 + + + + + + #797979 + + + + #CC5E89 + + + + #9C8528 + + + + #2A6484 + + + + #C1305D + + + template_argument + + + template_argument + + + template_argument + + + template_argument + + + + #247368 + + + #247368 + + + + #3D3D3D + #4D4D4D + + + + + #272728 + white
+ + white + black + + + darkgrey + #969696 + + + #343434 + #969696 + +
+ + #272728 + white + #878787 + #878787 + +
diff --git a/bin/test/data/log/test_log.txt b/bin/test/data/log/test_log.txt index 3aa9700a..5e4e1ebd 100644 --- a/bin/test/data/log/test_log.txt +++ b/bin/test/data/log/test_log.txt @@ -1,57 +1,57 @@ -Token.cpp ERROR: Location Id was not referenced by this Token. -Node.cpp WARNING: Cannot change NodeType after it was already set from namespace to class -Edge.cpp ERROR: Nodes are not plain copies. - INFO: send TestMessage - INFO: handle TestMessage - INFO: send TestMessage - INFO: handle TestMessage - INFO: send TestMessage - INFO: handle TestMessage - INFO: send TestMessage2 - INFO: handle TestMessage2 - INFO: send TestMessage - INFO: handle TestMessage - INFO: send TestMessage2 - INFO: handle TestMessage2 - INFO: send TestMessage - INFO: handle TestMessage - INFO: send TestMessage - INFO: handle TestMessage - INFO: send TestMessage2 - INFO: handle TestMessage2 - INFO: send TestMessage - INFO: handle TestMessage - INFO: send TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: send TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: send TestMessage - INFO: handle TestMessage - INFO: send TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: send TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: handle TestMessage - INFO: handle TestMessage -NetworkProtocolHelper.cpp ERROR: Failed to parse message, invalid type token -NetworkProtocolHelper.cpp ERROR: Failed to parse setActiveToken message, invalid token count -Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml -Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml -TextAccess.cpp ERROR: Could not open file path/to/test.h -TextAccess.cpp WARNING: Index 'firstLine' has to be lower or equal index 'lastLine', is 3 > 2 -TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8 -TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8 -TextAccess.cpp WARNING: Line numbers start with one, is 0 -TextAccess.cpp WARNING: Line numbers start with one, is 0 -TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 2:3 2:1 -TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 4:1 1:10 +Token.cpp ERROR: Location Id was not referenced by this Token. +Node.cpp WARNING: Cannot change NodeType after it was already set from namespace to class +Edge.cpp ERROR: Nodes are not plain copies. + INFO: send TestMessage + INFO: handle TestMessage + INFO: send TestMessage + INFO: handle TestMessage + INFO: send TestMessage + INFO: handle TestMessage + INFO: send TestMessage2 + INFO: handle TestMessage2 + INFO: send TestMessage + INFO: handle TestMessage + INFO: send TestMessage2 + INFO: handle TestMessage2 + INFO: send TestMessage + INFO: handle TestMessage + INFO: send TestMessage + INFO: handle TestMessage + INFO: send TestMessage2 + INFO: handle TestMessage2 + INFO: send TestMessage + INFO: handle TestMessage + INFO: send TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: send TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: send TestMessage + INFO: handle TestMessage + INFO: send TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: send TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: handle TestMessage + INFO: handle TestMessage +NetworkProtocolHelper.cpp ERROR: Failed to parse message, invalid type token +NetworkProtocolHelper.cpp ERROR: Failed to parse setActiveToken message, invalid token count +Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml +Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml +TextAccess.cpp ERROR: Could not open file path/to/test.h +TextAccess.cpp WARNING: Index 'firstLine' has to be lower or equal index 'lastLine', is 3 > 2 +TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8 +TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8 +TextAccess.cpp WARNING: Line numbers start with one, is 0 +TextAccess.cpp WARNING: Line numbers start with one, is 0 +TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 2:3 2:1 +TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 4:1 1:10 diff --git a/src/app/main.cpp b/src/app/main.cpp index cbff2b77..5b490ce0 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -13,6 +13,10 @@ #include "settings/ApplicationSettings.h" #include "utility/AppPath.h" #include "utility/commandline/CommandLineParser.h" +#include "utility/logging/ConsoleLogger.h" +#include "utility/logging/FileLogger.h" +#include "utility/logging/logging.h" +#include "utility/logging/LogManager.h" #include "utility/ResourcePaths.h" #include "utility/ScopedFunctor.h" #include "utility/UserPaths.h" @@ -20,6 +24,21 @@ #include "utility/Version.h" #include "version.h" +void setupLogging() +{ + LogManager::createInstance(); + LogManager* logManager = LogManager::getInstance().get(); + + std::shared_ptr consoleLogger = std::make_shared(); + consoleLogger->setLogLevel(Logger::LOG_WARNINGS | Logger::LOG_ERRORS); + logManager->addLogger(consoleLogger); + + std::shared_ptr fileLogger = std::make_shared(); + fileLogger->setLogDirectory(UserPaths::getLogPath()); + fileLogger->setLogLevel(Logger::LOG_ALL); + logManager->addLogger(fileLogger); +} + void prefillJavaRuntimePath() { std::shared_ptr settings = ApplicationSettings::getInstance(); @@ -92,6 +111,8 @@ int main(int argc, char *argv[]) setupApp(argc, argv); + setupLogging(); + Application::createInstance(version, nullptr, nullptr); ScopedFunctor f([](){ Application::destroyInstance(); @@ -130,6 +151,8 @@ int main(int argc, char *argv[]) setupApp(argc, argv); + setupLogging(); + qtApp.setAttribute(Qt::AA_UseHighDpiPixmaps); QtViewFactory viewFactory; diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp index 1acca0dd..9720695e 100644 --- a/src/lib/Application.cpp +++ b/src/lib/Application.cpp @@ -1,7 +1,5 @@ #include "Application.h" -#include "utility/logging/ConsoleLogger.h" -#include "utility/logging/FileLogger.h" #include "utility/logging/logging.h" #include "utility/logging/LogManager.h" #include "utility/messaging/MessageQueue.h" @@ -76,21 +74,7 @@ void Application::loadSettings() settings->load(FilePath(UserPaths::getAppSettingsPath())); LogManager* logManager = LogManager::getInstance().get(); - if (!settings->getLoggingEnabled()) - { - logManager->clearLoggers(); - } - else if (!logManager->getLoggerCount()) - { - std::shared_ptr consoleLogger = std::make_shared(); - consoleLogger->setLogLevel(Logger::LOG_WARNINGS | Logger::LOG_ERRORS); - logManager->addLogger(consoleLogger); - - std::shared_ptr fileLogger = std::make_shared(); - fileLogger->setLogDirectory(UserPaths::getLogPath()); - fileLogger->setLogLevel(Logger::LOG_ALL); - logManager->addLogger(fileLogger); - } + logManager->setLoggingEnabled(settings->getLoggingEnabled()); loadStyle(settings->getColorSchemePath()); } diff --git a/src/lib/component/controller/ErrorController.cpp b/src/lib/component/controller/ErrorController.cpp index b6eebfc5..441f1dce 100644 --- a/src/lib/component/controller/ErrorController.cpp +++ b/src/lib/component/controller/ErrorController.cpp @@ -42,6 +42,10 @@ void ErrorController::handleMessage(MessageShowErrors* message) { if (message->errorId) { + if (message->isReplayed()) + { + getView()->setErrorId(message->errorId); + } return; } diff --git a/src/lib/component/controller/FeatureController.cpp b/src/lib/component/controller/FeatureController.cpp index d8c006ff..36b9b1da 100644 --- a/src/lib/component/controller/FeatureController.cpp +++ b/src/lib/component/controller/FeatureController.cpp @@ -7,6 +7,7 @@ #include "utility/messaging/type/MessageActivateTokens.h" #include "utility/messaging/type/MessageChangeFileView.h" #include "utility/messaging/type/MessageColorSchemeTest.h" +#include "utility/messaging/type/MessageFlushUpdates.h" #include "utility/messaging/type/MessageRefresh.h" #include "utility/messaging/type/MessageShowErrors.h" #include "utility/messaging/type/MessageStatus.h" @@ -138,8 +139,9 @@ void FeatureController::handleMessage(MessageSearch* message) case SearchMatch::COMMAND_ERROR: { MessageShowErrors msg(m_storageAccess->getErrorCount()); - msg.setIsReplayed(message->isReplayed()); - msg.dispatchImmediately(); + msg.setIsReplayed(true); + msg.dispatch(); + MessageFlushUpdates().dispatch(); return; } diff --git a/src/lib/component/controller/UndoRedoController.cpp b/src/lib/component/controller/UndoRedoController.cpp index f0b39956..0401dab6 100644 --- a/src/lib/component/controller/UndoRedoController.cpp +++ b/src/lib/component/controller/UndoRedoController.cpp @@ -235,6 +235,18 @@ void UndoRedoController::handleMessage(MessageSearchFullText* message) processCommand(command); } +void UndoRedoController::handleMessage(MessageShowErrors* message) +{ + if (sameMessageTypeAsLast(message) && + static_cast(lastMessage())->errorId == message->errorId) + { + return; + } + + Command command(std::make_shared(*message), Command::ORDER_ACTIVATE); + processCommand(command); +} + void UndoRedoController::handleMessage(MessageShowScope* message) { Command command(std::make_shared(*message), Command::ORDER_VIEW); @@ -347,6 +359,11 @@ void UndoRedoController::replayCommands(std::list::iterator it) void UndoRedoController::processCommand(Command command) { + if (command.message->isReplayed()) + { + return; + } + if (command.order != Command::ORDER_ACTIVATE && m_iterator == m_list.begin()) { return; @@ -357,40 +374,37 @@ void UndoRedoController::processCommand(Command command) command.order = Command::ORDER_ADAPT; } - if (!command.message->isReplayed()) + if (command.order == Command::ORDER_ACTIVATE) { - if (command.order == Command::ORDER_ACTIVATE) + m_iterator = m_list.erase(m_iterator, m_list.end()); + } + else if (command.order == Command::ORDER_ADAPT) + { + std::list::iterator end = m_iterator; + while (end != m_list.end()) { - m_iterator = m_list.erase(m_iterator, m_list.end()); - } - else if (command.order == Command::ORDER_ADAPT) - { - std::list::iterator end = m_iterator; - while (end != m_list.end()) + if (end->order == Command::ORDER_ACTIVATE) { - if (end->order == Command::ORDER_ACTIVATE) - { - break; - } - std::advance(end, 1); + break; } - - m_iterator = m_list.erase(m_iterator, end); + std::advance(end, 1); } - m_list.insert(m_iterator, command); + m_iterator = m_list.erase(m_iterator, end); + } - if (command.order != Command::ORDER_VIEW) + m_list.insert(m_iterator, command); + + if (command.order != Command::ORDER_VIEW) + { + if (m_list.begin() != std::prev(m_iterator)) { - if (m_list.begin() != std::prev(m_iterator)) - { - getView()->setUndoButtonEnabled(true); - } + getView()->setUndoButtonEnabled(true); + } - if (m_list.end() == m_iterator) - { - getView()->setRedoButtonEnabled(false); - } + if (m_list.end() == m_iterator) + { + getView()->setRedoButtonEnabled(false); } } } diff --git a/src/lib/component/controller/UndoRedoController.h b/src/lib/component/controller/UndoRedoController.h index befe07ad..619b2a9d 100644 --- a/src/lib/component/controller/UndoRedoController.h +++ b/src/lib/component/controller/UndoRedoController.h @@ -20,6 +20,7 @@ #include "utility/messaging/type/MessageScrollCode.h" #include "utility/messaging/type/MessageSearch.h" #include "utility/messaging/type/MessageSearchFullText.h" +#include "utility/messaging/type/MessageShowErrors.h" #include "utility/messaging/type/MessageShowScope.h" #include "utility/messaging/type/MessageUndo.h" @@ -45,6 +46,7 @@ class UndoRedoController , public MessageListener , public MessageListener , public MessageListener + , public MessageListener , public MessageListener , public MessageListener { @@ -88,6 +90,7 @@ private: virtual void handleMessage(MessageScrollCode* message); virtual void handleMessage(MessageSearch* message); virtual void handleMessage(MessageSearchFullText* message); + virtual void handleMessage(MessageShowErrors* message); virtual void handleMessage(MessageShowScope* message); virtual void handleMessage(MessageUndo* message); diff --git a/src/lib/component/view/ErrorView.h b/src/lib/component/view/ErrorView.h index d4c1096f..d7f9434a 100644 --- a/src/lib/component/view/ErrorView.h +++ b/src/lib/component/view/ErrorView.h @@ -18,6 +18,7 @@ public: virtual void clear() = 0; virtual void addError(const StorageError& error) = 0; + virtual void setErrorId(Id errorId) = 0; }; #endif // ERROR_VIEW_H diff --git a/src/lib/data/search/SearchIndex.cpp b/src/lib/data/search/SearchIndex.cpp index a13e94c1..48e80611 100644 --- a/src/lib/data/search/SearchIndex.cpp +++ b/src/lib/data/search/SearchIndex.cpp @@ -389,8 +389,14 @@ int SearchIndex::score(const std::string& text, const std::vector& indic size_t index = indices[i]; + // after no letter + bool prevIsNoLetter = (index == 0 || noLetters.find(text[index - 1]) != noLetters.end()); + if (prevIsNoLetter) + { + noLetterScore += noLetterBonus; + } // camel case - if (isupper(text[index])) + else if (isupper(text[index])) { bool prevIsLower = (index > 0 && islower(text[index - 1])); bool nextIsLower = (index + 1 == text.size() || islower(text[index + 1])); @@ -400,13 +406,6 @@ int SearchIndex::score(const std::string& text, const std::vector& indic camelCaseScore += camelCaseBonus; } } - - // after no letter - bool prevIsNoLetter = (index == 0 || noLetters.find(text[index - 1]) != noLetters.end()); - if (prevIsNoLetter) - { - noLetterScore += noLetterBonus; - } } int leadingStartScore = std::max(int(indices[0]) * delayedStartBonus, minDelayedStartBonus); diff --git a/src/lib/utility/logging/LogManager.cpp b/src/lib/utility/logging/LogManager.cpp index e1feebf0..26a0ffbc 100644 --- a/src/lib/utility/logging/LogManager.cpp +++ b/src/lib/utility/logging/LogManager.cpp @@ -4,9 +4,8 @@ #include "utility/logging/LogMessage.h" -std::shared_ptr LogManager::getInstance() +std::shared_ptr LogManager::createInstance() { - std::lock_guard lockGuard(s_instanceMutex); if (s_instance.use_count() == 0) { s_instance = std::shared_ptr(new LogManager()); @@ -14,9 +13,13 @@ std::shared_ptr LogManager::getInstance() return s_instance; } +std::shared_ptr LogManager::getInstance() +{ + return s_instance; +} + void LogManager::destroyInstance() { - std::lock_guard lockGuard(s_instanceMutex); s_instance.reset(); } @@ -24,6 +27,11 @@ LogManager::~LogManager() { } +void LogManager::setLoggingEnabled(bool enabled) +{ + m_loggingEnabled = enabled; +} + void LogManager::addLogger(std::shared_ptr logger) { m_logManagerImplementation.addLogger(logger); @@ -56,7 +64,10 @@ void LogManager::logInfo( const unsigned int line ) { - m_logManagerImplementation.logInfo(message, file, function, line); + if (m_loggingEnabled) + { + m_logManagerImplementation.logInfo(message, file, function, line); + } } void LogManager::logWarning( @@ -66,7 +77,10 @@ void LogManager::logWarning( const unsigned int line ) { - m_logManagerImplementation.logWarning(message, file, function, line); + if (m_loggingEnabled) + { + m_logManagerImplementation.logWarning(message, file, function, line); + } } void LogManager::logError( @@ -76,12 +90,15 @@ void LogManager::logError( const unsigned int line ) { - m_logManagerImplementation.logError(message, file, function, line); + if (m_loggingEnabled) + { + m_logManagerImplementation.logError(message, file, function, line); + } } std::shared_ptr LogManager::s_instance; -std::mutex LogManager::s_instanceMutex; LogManager::LogManager() + : m_loggingEnabled(false) { } diff --git a/src/lib/utility/logging/LogManager.h b/src/lib/utility/logging/LogManager.h index 6b0d133c..57a877b0 100644 --- a/src/lib/utility/logging/LogManager.h +++ b/src/lib/utility/logging/LogManager.h @@ -2,7 +2,6 @@ #define LOG_MANAGER_H #include -#include #include "utility/logging/Logger.h" #include "utility/logging/LogManagerImplementation.h" @@ -10,11 +9,14 @@ class LogManager { public: + static std::shared_ptr createInstance(); static std::shared_ptr getInstance(); static void destroyInstance(); ~LogManager(); + void setLoggingEnabled(bool enabled); + void addLogger(std::shared_ptr logger); void removeLogger(std::shared_ptr logger); void removeLoggersByType(const std::string& type); @@ -42,13 +44,13 @@ public: private: static std::shared_ptr s_instance; - static std::mutex s_instanceMutex; LogManager(); LogManager(const LogManager&); void operator=(const LogManager&); LogManagerImplementation m_logManagerImplementation; + bool m_loggingEnabled; }; #endif // LOG_MANAGER_H diff --git a/src/lib/utility/messaging/type/MessageActivateEdge.h b/src/lib/utility/messaging/type/MessageActivateEdge.h index 9333a6d7..d95df132 100644 --- a/src/lib/utility/messaging/type/MessageActivateEdge.h +++ b/src/lib/utility/messaging/type/MessageActivateEdge.h @@ -17,7 +17,10 @@ public: , fromNameHierarchy(fromName) , toNameHierarchy(toName) { - setKeepContent(true); + if (!isAggregation()) + { + setKeepContent(true); + } } static const std::string getStaticType() diff --git a/src/lib/utility/solution/SolutionParserVisualStudio.cpp b/src/lib/utility/solution/SolutionParserVisualStudio.cpp index bacdadf5..12fd9deb 100644 --- a/src/lib/utility/solution/SolutionParserVisualStudio.cpp +++ b/src/lib/utility/solution/SolutionParserVisualStudio.cpp @@ -270,7 +270,10 @@ std::string SolutionParserVisualStudio::getButtonText() const std::string SolutionParserVisualStudio::getDescription() const { - return "Create a new project from an existing Visual Studio Solution file. Unstable!"; + return "Create a new project from an existing Visual Studio Solution file. " + "Unstable: Please install our new Visual " + "Studio plugin and use the \"Create CDB\" menu option, then continue with project setup from " + "Compilation Database."; } std::string SolutionParserVisualStudio::getIconPath() const diff --git a/src/lib_gui/qt/element/QtAutocompletionList.cpp b/src/lib_gui/qt/element/QtAutocompletionList.cpp index 9e286029..6d3be70b 100644 --- a/src/lib_gui/qt/element/QtAutocompletionList.cpp +++ b/src/lib_gui/qt/element/QtAutocompletionList.cpp @@ -125,7 +125,6 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt "----------------------------------------------------------------------------------------------------" "----------------------------------------------------------------------------------------------------" ) / 500.0f; - painter->drawText(option.rect.adjusted(charWidth + 2, -1, 0, 0), Qt::AlignLeft, name); QString highlightName(name.size(), ' '); @@ -136,11 +135,12 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt { int idx = indices[i].toInt(); - QRect rect = option.rect.adjusted(charWidth * (idx + 1) + 1, 2, 0, -1); - rect.setWidth(charWidth + 2); + QRect rect = option.rect.adjusted(charWidth * (idx + 1) + 2, 2, 0, -1); + rect.setWidth(charWidth + 1); painter->fillRect(rect, color); highlightName[idx] = name.at(idx); + name[idx] = ' '; } } else @@ -150,6 +150,8 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt painter->fillRect(rect, color); } + painter->drawText(option.rect.adjusted(charWidth + 2, -1, 0, 0), Qt::AlignLeft, name); + painter->save(); QPen highlightPen = painter->pen(); highlightPen.setColor(textColor); @@ -160,12 +162,8 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt if (type.size()) { QFont font = painter->font(); - if (font.pointSize() > 0) - { - QFont typeFont = font; - typeFont.setPointSize(ApplicationSettings::getInstance()->getFontSize() - 4); - painter->setFont(typeFont); - } + font.setPixelSize(ApplicationSettings::getInstance()->getFontSize() - 4); + painter->setFont(font); QPen typePen = painter->pen(); typePen.setColor(scheme->getColor("search/popup/by_text").c_str()); diff --git a/src/lib_gui/qt/view/QtErrorView.cpp b/src/lib_gui/qt/view/QtErrorView.cpp index ffc76e70..41e5e390 100644 --- a/src/lib_gui/qt/view/QtErrorView.cpp +++ b/src/lib_gui/qt/view/QtErrorView.cpp @@ -24,6 +24,8 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout) , m_clearFunctor(std::bind(&QtErrorView::doClear, this)) , m_refreshFunctor(std::bind(&QtErrorView::doRefreshView, this)) , m_addErrorFunctor(std::bind(&QtErrorView::doAddError, this, std::placeholders::_1)) + , m_setErrorIdFunctor(std::bind(&QtErrorView::doSetErrorId, this, std::placeholders::_1)) + , m_ignoreNextSelection(false) { } @@ -76,7 +78,7 @@ void QtErrorView::initView() connect(m_table->selectionModel(), &QItemSelectionModel::currentRowChanged, [=](const QModelIndex& index, const QModelIndex& previousIndex) { - if (index.isValid()) + if (index.isValid() && !m_ignoreNextSelection) { if (m_model->item(index.row(), COLUMN::FILE) == nullptr) { @@ -85,6 +87,8 @@ void QtErrorView::initView() MessageShowErrors(m_model->item(index.row(), COLUMN::ID)->text().toUInt()).dispatch(); } + + m_ignoreNextSelection = false; }); layout->addWidget(m_table); @@ -120,8 +124,9 @@ void QtErrorView::addError(const StorageError& error) m_addErrorFunctor(error); } -void QtErrorView::clickedInEmptySpace() +void QtErrorView::setErrorId(Id errorId) { + m_setErrorIdFunctor(errorId); } void QtErrorView::doRefreshView() @@ -151,6 +156,17 @@ void QtErrorView::doAddError(const StorageError& error) addErrorToTable(error); } +void QtErrorView::doSetErrorId(Id errorId) +{ + QList items = m_model->findItems(QString::number(errorId), Qt::MatchExactly, COLUMN::ID); + + if (items.size() == 1) + { + m_ignoreNextSelection = true; + m_table->selectRow(items.at(0)->row()); + } +} + void QtErrorView::setStyleSheet() const { QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this); diff --git a/src/lib_gui/qt/view/QtErrorView.h b/src/lib_gui/qt/view/QtErrorView.h index 800ed381..67d7da53 100644 --- a/src/lib_gui/qt/view/QtErrorView.h +++ b/src/lib_gui/qt/view/QtErrorView.h @@ -30,9 +30,7 @@ public: // ErrorView implementation virtual void clear(); virtual void addError(const StorageError& error); - -private slots: - void clickedInEmptySpace(); + virtual void setErrorId(Id errorId); private: enum COLUMN { @@ -47,6 +45,7 @@ private: void doRefreshView(); void doClear(); void doAddError(const StorageError& error); + void doSetErrorId(Id errorId); void setStyleSheet() const; @@ -58,6 +57,7 @@ private: QtThreadedFunctor m_clearFunctor; QtThreadedFunctor m_refreshFunctor; QtThreadedFunctor m_addErrorFunctor; + QtThreadedFunctor m_setErrorIdFunctor; QCheckBox* m_showErrors; QCheckBox* m_showFatals; @@ -69,6 +69,8 @@ private: std::vector m_errors; QPalette* m_palette; + + bool m_ignoreNextSelection; }; #endif // QT_ERROR_VIEW_H diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp index c4e6abd8..980f9066 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp @@ -137,7 +137,8 @@ void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& r m_projectFileLocation->setPickDirectory(true); layout->addWidget(locationLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); - layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL); + layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop); + layout->setRowMinimumHeight(row, 30); row++; } diff --git a/src/test/TestSuiteFixture.cpp b/src/test/TestSuiteFixture.cpp index 7bac2122..84d77554 100644 --- a/src/test/TestSuiteFixture.cpp +++ b/src/test/TestSuiteFixture.cpp @@ -18,8 +18,12 @@ TestSuiteFixture::~TestSuiteFixture() bool TestSuiteFixture::setUpWorld() { - LogManager::getInstance()->addLogger(std::make_shared("data/log/test_log.txt")); - LogManager::getInstance()->addLogger(std::make_shared()); + LogManager* logManager = LogManager::createInstance().get(); + + logManager->setLoggingEnabled(true); + logManager->addLogger(std::make_shared("data/log/test_log.txt")); + logManager->addLogger(std::make_shared()); + ApplicationSettings::getInstance()->load(FilePath("data/TestSettings.xml")); return true;