ui: Refactored QtCodeSnippet and added view settings to ApplicationSettings

This change refactors parts of the QtCodeSnippet and places some settings into ApplicationSettings.
Additionally Application- and ProjectSettings were abstracted to the common base class Settings, which takes care of the
getting and setting values of the Configmanager member.
This commit is contained in:
Eberhard Graether
2014-07-03 16:10:55 +02:00
parent 4ae6f4a04a
commit 042a508422
15 changed files with 254 additions and 125 deletions
+2 -15
View File
@@ -6,7 +6,6 @@
#include "data/location/TokenLocationFile.h"
#include "qt/element/QtCodeSnippet.h"
#include "qt/QtWidgetWrapper.h"
#include "qt/utility/QtHighLighter.h"
#include "qt/utility/utilityQt.h"
#include "utility/messaging/type/MessageActivateToken.h"
@@ -35,10 +34,6 @@ void QtCodeView::initGui()
layout->setSpacing(3);
layout->setContentsMargins(3, 3, 3, 3);
widget->setLayout(layout);
m_font.setFamily("Courier");
m_font.setFixedPitch(true);
m_font.setPointSize(10);
}
void QtCodeView::addCodeSnippet(const std::string& str, const TokenLocationFile& locationFile, int startLineNumber)
@@ -59,18 +54,10 @@ void QtCodeView::activateToken(Id tokenId) const
void QtCodeView::doAddCodeSnippet(const std::string& str, const TokenLocationFile& locationFile, int startLineNumber)
{
std::shared_ptr<Snippet> snippet = std::make_shared<Snippet>();
snippet->textField = std::make_shared<QtCodeSnippet>(this, startLineNumber);
snippet->textField->setReadOnly(true);
snippet->textField->setFont(m_font);
snippet->highlighter = std::make_shared<QtHighlighter>(snippet->textField->document());
snippet->textField->setPlainText(QString::fromUtf8(str.c_str()));
snippet->textField->annotateText(locationFile);
std::shared_ptr<QtCodeSnippet> snippet = std::make_shared<QtCodeSnippet>(this, str, locationFile, startLineNumber);
QWidget* widget = QtWidgetWrapper::getWidgetOfView(this);
widget->layout()->addWidget(snippet->textField.get());
widget->layout()->addWidget(snippet.get());
m_snippets.push_back(snippet);
}