ui: remove MessageNewLog

* remove Logging checkboxes in prefernces
* commandline parser project path is absolute when called from commandline
This commit is contained in:
Andreas Stallinger
2016-11-14 13:38:31 +01:00
parent c95eecdd7e
commit 56ab09159b
16 changed files with 30 additions and 76 deletions
+1
View File
@@ -175,6 +175,7 @@ int main(int argc, char *argv[])
Application::destroyInstance();
});
prefillJavaRuntimePath();
prefillCxxHeaderPaths();
prefillCxxFrameworkPaths();
-3
View File
@@ -73,9 +73,6 @@ void Application::loadSettings()
std::shared_ptr<ApplicationSettings> settings = ApplicationSettings::getInstance();
settings->load(FilePath(UserPaths::getAppSettingsPath()));
LogManager* logManager = LogManager::getInstance().get();
logManager->setLoggingEnabled(settings->getLoggingEnabled());
loadStyle(settings->getColorSchemePath());
}
-1
View File
@@ -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
@@ -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);
}
@@ -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<MessageNewLog>
{
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);
@@ -173,7 +173,7 @@ void CommandLineParser::processProjectfile(const std::string& file)
return;
}
m_projectFile = projectfile;
m_projectFile = projectfile.absolute();
}
void CommandLineParser::projectLoad()
@@ -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<MessageNewLog>
{
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
+15
View File
@@ -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
+1
View File
@@ -10,6 +10,7 @@ public:
QtApplication(int& argc, char** argv);
bool event(QEvent *event);
int exec();
};
#endif // QT_APPLICATION_H
+1
View File
@@ -10,6 +10,7 @@
#include "settings/ApplicationSettings.h"
class SelectableCellDelegate : public QStyledItemDelegate
{
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+1
View File
@@ -13,6 +13,7 @@ public:
virtual ~QtTable();
void updateRows();
void setTableModel(QAbstractItemModel* model);
int getFilledRowCount();
void showLastRow();
+1
View File
@@ -59,6 +59,7 @@ void QtErrorView::createWidgetWrapper()
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(new QFrame()));
}
#include <QSortFilterProxyModel>
void QtErrorView::initView()
{
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
+6 -3
View File
@@ -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,
@@ -119,9 +119,9 @@ void QtProjectWizzard::newProjectFromSolution(const std::string& ideId, const st
void QtProjectWizzard::newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths)
{
FilePath fp(filePath);
std::vector<FilePath> hp;
for (int i = 0; i < headerPaths.size(); i++)
for (size_t i = 0; i < headerPaths.size(); i++)
{
hp.push_back(FilePath(headerPaths[i]));
}
@@ -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<std::string> detectorNames = m_javaPathDetector->getWorkingDetectorNames();
@@ -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<FilePath> m_colorSchemePaths;
int m_oldColorSchemeIndex;
QCheckBox* m_loggingEnabled;
QCheckBox* m_verboseIndexerLoggingEnabled;
QLineEdit* m_scrollSpeed;
QCheckBox* m_graphZooming;