diff --git a/src/app/main.cpp b/src/app/main.cpp index 9c636f64..a15749fd 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -175,6 +175,7 @@ int main(int argc, char *argv[]) Application::destroyInstance(); }); + prefillJavaRuntimePath(); prefillCxxHeaderPaths(); prefillCxxFrameworkPaths(); diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp index 444e2d5d..6754fd41 100644 --- a/src/lib/Application.cpp +++ b/src/lib/Application.cpp @@ -73,9 +73,6 @@ void Application::loadSettings() std::shared_ptr settings = ApplicationSettings::getInstance(); settings->load(FilePath(UserPaths::getAppSettingsPath())); - LogManager* logManager = LogManager::getInstance().get(); - logManager->setLoggingEnabled(settings->getLoggingEnabled()); - loadStyle(settings->getColorSchemePath()); } diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 0b119cef..a99a8187 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -288,7 +288,6 @@ add_files( utility/messaging/type/MessageLoadProject.h utility/messaging/type/MessageMoveIDECursor.h utility/messaging/type/MessageNewErrors.h - utility/messaging/type/MessageNewLog.h utility/messaging/type/MessagePluginPortChange.h utility/messaging/type/MessageProjectEdit.h utility/messaging/type/MessageProjectNew.h diff --git a/src/lib/component/controller/LogController.cpp b/src/lib/component/controller/LogController.cpp index 98b89daa..3d8b865a 100644 --- a/src/lib/component/controller/LogController.cpp +++ b/src/lib/component/controller/LogController.cpp @@ -39,11 +39,6 @@ void LogController::logWarning(const LogMessage& message ) void LogController::addLog(Logger::LogLevel type, const LogMessage& message) { - MessageNewLog(type,message).dispatch(); -} - -void LogController::handleMessage(MessageNewLog* message) -{ - getView()->addLog(message->type, message->message); + getView()->addLog(type, message); } diff --git a/src/lib/component/controller/LogController.h b/src/lib/component/controller/LogController.h index 9064221b..311a070a 100644 --- a/src/lib/component/controller/LogController.h +++ b/src/lib/component/controller/LogController.h @@ -6,15 +6,12 @@ #include "utility/logging/Logger.h" #include "utility/logging/LogMessage.h" -#include "utility/messaging/type/MessageNewLog.h" -#include "utility/messaging/MessageListener.h" class StorageAccess; class LogController : public Controller , public Logger - , public MessageListener { public: LogController(); @@ -23,7 +20,6 @@ public: private: LogView* getView() const; - virtual void handleMessage(MessageNewLog* message); virtual void clear(); virtual void logInfo(const LogMessage& message); diff --git a/src/lib/utility/commandline/CommandLineParser.cpp b/src/lib/utility/commandline/CommandLineParser.cpp index c0a0f771..b73481ac 100644 --- a/src/lib/utility/commandline/CommandLineParser.cpp +++ b/src/lib/utility/commandline/CommandLineParser.cpp @@ -173,7 +173,7 @@ void CommandLineParser::processProjectfile(const std::string& file) return; } - m_projectFile = projectfile; + m_projectFile = projectfile.absolute(); } void CommandLineParser::projectLoad() diff --git a/src/lib/utility/messaging/type/MessageNewLog.h b/src/lib/utility/messaging/type/MessageNewLog.h deleted file mode 100644 index a6ec888b..00000000 --- a/src/lib/utility/messaging/type/MessageNewLog.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef MESSAGE_NEW_LOG_H -#define MESSAGE_NEW_LOG_H - -#include "utility/messaging/Message.h" - -#include "utility/logging/logging.h" - -class MessageNewLog - : public Message -{ -public: - MessageNewLog(const Logger::LogLevel type, const LogMessage& message) - : type(type) - , message(message) - { - setSendAsTask(false); - setIsLogged(false); - } - - static const std::string getStaticType() - { - return "MessageNewLog"; - } - - virtual void print(std::ostream& os) const - { - os << "Log: " << message.message; - } - - const Logger::LogLevel type; - const LogMessage message; -}; - -#endif // MESSAGE_NEW_LOG_H diff --git a/src/lib_gui/qt/QtApplication.cpp b/src/lib_gui/qt/QtApplication.cpp index adf1c7b7..7f50551a 100644 --- a/src/lib_gui/qt/QtApplication.cpp +++ b/src/lib_gui/qt/QtApplication.cpp @@ -5,10 +5,25 @@ #include "utility/file/FilePath.h" #include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageLoadProject.h" +#include "utility/logging/LogManager.h" +#include "settings/ApplicationSettings.h" QtApplication::QtApplication(int& argc, char** argv) : QApplication(argc, argv) { + connect(this, &QCoreApplication::aboutToQuit, + [=]() + { + LogManager::getInstance()->setLoggingEnabled(false); + }); + +} + +int QtApplication::exec() +{ + LogManager::getInstance()->setLoggingEnabled(ApplicationSettings::getInstance()->getLoggingEnabled()); + + return QCoreApplication::exec(); } // responds to FileOpenEvent specific for Mac diff --git a/src/lib_gui/qt/QtApplication.h b/src/lib_gui/qt/QtApplication.h index b0c53123..ff369bca 100644 --- a/src/lib_gui/qt/QtApplication.h +++ b/src/lib_gui/qt/QtApplication.h @@ -10,6 +10,7 @@ public: QtApplication(int& argc, char** argv); bool event(QEvent *event); + int exec(); }; #endif // QT_APPLICATION_H diff --git a/src/lib_gui/qt/element/QtTable.cpp b/src/lib_gui/qt/element/QtTable.cpp index 85d0f962..57b1cad7 100644 --- a/src/lib_gui/qt/element/QtTable.cpp +++ b/src/lib_gui/qt/element/QtTable.cpp @@ -10,6 +10,7 @@ #include "settings/ApplicationSettings.h" + class SelectableCellDelegate : public QStyledItemDelegate { QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; diff --git a/src/lib_gui/qt/element/QtTable.h b/src/lib_gui/qt/element/QtTable.h index 134881eb..90cfbfd3 100644 --- a/src/lib_gui/qt/element/QtTable.h +++ b/src/lib_gui/qt/element/QtTable.h @@ -13,6 +13,7 @@ public: virtual ~QtTable(); void updateRows(); + void setTableModel(QAbstractItemModel* model); int getFilledRowCount(); void showLastRow(); diff --git a/src/lib_gui/qt/view/QtErrorView.cpp b/src/lib_gui/qt/view/QtErrorView.cpp index 0dd5961c..31898fe2 100644 --- a/src/lib_gui/qt/view/QtErrorView.cpp +++ b/src/lib_gui/qt/view/QtErrorView.cpp @@ -59,6 +59,7 @@ void QtErrorView::createWidgetWrapper() setWidgetWrapper(std::make_shared(new QFrame())); } +#include void QtErrorView::initView() { QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this); diff --git a/src/lib_gui/qt/view/QtLogView.cpp b/src/lib_gui/qt/view/QtLogView.cpp index bb31e55f..3f8f6edb 100644 --- a/src/lib_gui/qt/view/QtLogView.cpp +++ b/src/lib_gui/qt/view/QtLogView.cpp @@ -12,6 +12,7 @@ #include "utility/messaging/type/MessageRefresh.h" #include "utility/ResourcePaths.h" #include "qt/utility/utilityQt.h" +#include "utility/logging/LogManager.h" #include "qt/element/QtTable.h" @@ -44,8 +45,9 @@ void QtLogView::initView() QHBoxLayout* headerLayout = new QHBoxLayout(); headerLayout->addSpacing(10); - m_viewEnabled = new QCheckBox("Enable"); + m_viewEnabled = new QCheckBox("Logging enabled (file, console logging)"); m_viewEnabled->setChecked(ApplicationSettings::getInstance()->getLoggingEnabled()); + connect(m_viewEnabled, &QCheckBox::stateChanged, [=](int){ setLoggingEnabled(m_viewEnabled->isChecked()); @@ -53,7 +55,7 @@ void QtLogView::initView() ); headerLayout->addWidget(m_viewEnabled); headerLayout->addSpacing(25); - m_showAstLogging = new QCheckBox("Ast"); + m_showAstLogging = new QCheckBox("AST Logging"); m_showAstLogging->setEnabled(m_viewEnabled->isChecked()); m_showAstLogging->setChecked(ApplicationSettings::getInstance()->getVerboseIndexerLoggingEnabled()); connect(m_showAstLogging, &QCheckBox::stateChanged, @@ -119,6 +121,7 @@ QCheckBox* QtLogView::createFilterCheckbox(const QString& name, QBoxLayout* layo void QtLogView::setLoggingEnabled(bool enabled) { m_showAstLogging->setEnabled(enabled); + LogManager::getInstance()->setLoggingEnabled(true); ApplicationSettings::getInstance()->setLoggingEnabled(enabled); ApplicationSettings::getInstance()->save(); @@ -246,7 +249,7 @@ void QtLogView::addLogToTable(Log log) void QtLogView::doAddLog(Logger::LogLevel type, const LogMessage& message) { - if (m_viewEnabled->isChecked() && isCheckedType(type)) + if (isCheckedType(type)) { Log log( type, diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index 49593785..c5fbb669 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -119,9 +119,9 @@ void QtProjectWizzard::newProjectFromSolution(const std::string& ideId, const st void QtProjectWizzard::newProjectFromCDB(const std::string& filePath, const std::vector& headerPaths) { FilePath fp(filePath); - + std::vector hp; - for (int i = 0; i < headerPaths.size(); i++) + for (size_t i = 0; i < headerPaths.size(); i++) { hp.push_back(FilePath(headerPaths[i])); } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp index c4410664..ec58218b 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp @@ -57,13 +57,6 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row) } connect(m_colorSchemes, SIGNAL(activated(int)), this, SLOT(colorSchemeChanged(int))); - // logging - m_loggingEnabled = addCheckBox("Logging", "Enable console and file logging", - "Save log files and show log information in the console.", layout, row); - connect(m_loggingEnabled, SIGNAL(clicked()), this, SLOT(loggingEnabledChanged())); - - m_verboseIndexerLoggingEnabled = addCheckBox("Indexer Logging", "Enable verbose indexer logging", "", layout, row); - addGap(layout, row); // Controls @@ -171,10 +164,6 @@ void QtProjectWizzardContentPreferences::load() } } - m_loggingEnabled->setChecked(appSettings->getLoggingEnabled()); - m_verboseIndexerLoggingEnabled->setChecked(appSettings->getVerboseIndexerLoggingEnabled()); - m_verboseIndexerLoggingEnabled->setEnabled(m_loggingEnabled->isChecked()); - m_scrollSpeed->setText(QString::number(appSettings->getScrollSpeed(), 'f', 1)); m_graphZooming->setChecked(appSettings->getControlsGraphZoomOnMouseWheel()); @@ -203,9 +192,6 @@ void QtProjectWizzardContentPreferences::save() appSettings->setColorSchemePath(m_colorSchemePaths[m_colorSchemes->currentIndex()]); m_oldColorSchemeIndex = -1; - appSettings->setLoggingEnabled(m_loggingEnabled->isChecked()); - appSettings->setVerboseIndexerLoggingEnabled(m_verboseIndexerLoggingEnabled->isChecked()); - float scrollSpeed = m_scrollSpeed->text().toFloat(); if (scrollSpeed) appSettings->setScrollSpeed(scrollSpeed); @@ -248,11 +234,6 @@ void QtProjectWizzardContentPreferences::javaPathDetectionClicked() } } -void QtProjectWizzardContentPreferences::loggingEnabledChanged() -{ - m_verboseIndexerLoggingEnabled->setEnabled(m_loggingEnabled->isChecked()); -} - void QtProjectWizzardContentPreferences::addJavaPathDetection(QGridLayout* layout, int& row) { std::vector detectorNames = m_javaPathDetector->getWorkingDetectorNames(); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h index 9a6482d3..c4904914 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h @@ -29,7 +29,6 @@ public: private slots: void colorSchemeChanged(int index); void javaPathDetectionClicked(); - void loggingEnabledChanged(); private: void addJavaPathDetection(QGridLayout* layout, int& row); @@ -50,8 +49,6 @@ private: QComboBox* m_colorSchemes; std::vector m_colorSchemePaths; int m_oldColorSchemeIndex; - QCheckBox* m_loggingEnabled; - QCheckBox* m_verboseIndexerLoggingEnabled; QLineEdit* m_scrollSpeed; QCheckBox* m_graphZooming;