ui: new style for CodeView
@@ -1,62 +1,105 @@
|
||||
#code_file #title_label {
|
||||
background-color: rgb(220,220,220);
|
||||
#code_file_list {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#code_file {
|
||||
background-color: white;
|
||||
border: 2px solid #E0E0E0;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
#code_file #title_widget {
|
||||
background-color: #E0E0E0;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
font-family: "Source Code Pro";
|
||||
margin-bottom: 5px;
|
||||
min-height: 28px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
#code_file #title_label {
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
padding: 4px 12px;
|
||||
padding: 2px 4px;
|
||||
margin: 2px 8px;
|
||||
}
|
||||
|
||||
#code_file #title_label:hover {
|
||||
background: #D2D2D2;
|
||||
background-color: #D0D0D0;
|
||||
}
|
||||
|
||||
#code_file #title_label:disabled {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #title_label {
|
||||
background-color: rgb(220,220,220);
|
||||
#code_file #code_snippet{
|
||||
border-top: 2px solid #E0E0E0;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
#code_file #code_snippet[isFirst=true] {
|
||||
border: none;
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #scope_name, #code_file #code_snippet #dots {
|
||||
background: none;
|
||||
color: gray;
|
||||
border: none;
|
||||
font-family: "Source Code Pro";
|
||||
border-top-right-radius: 10px;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
padding: 4px 12px;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #dots {
|
||||
padding-right: 13px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #scope_name {
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
#code_area {
|
||||
background-color: transparent;
|
||||
font-family: "Source Code Pro";
|
||||
font-size: 14px;
|
||||
margin-bottom: 2px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#code_area #line_number_area {
|
||||
background-color: white;
|
||||
font-family: "Source Code Pro";
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#code_file #maximize_button {
|
||||
background-color: lightgray;
|
||||
border-image: none;
|
||||
border-radius: 8px;
|
||||
margin: 1px;
|
||||
#code_file #maximize_button, #code_file #snippet_button, #code_file #minimize_button {
|
||||
margin: 3px;
|
||||
max-height: 16px;
|
||||
max-width: 16px;
|
||||
}
|
||||
|
||||
#code_file #maximize_button {
|
||||
border-image: url(data/gui/code_view/images/maximize_inactive.png);
|
||||
}
|
||||
|
||||
#code_file #maximize_button:enabled {
|
||||
border-image: url(data/gui/code_view/images/button_maximize.png);
|
||||
border-image: url(data/gui/code_view/images/maximize_active.png);
|
||||
}
|
||||
|
||||
#code_area #maximize_button {
|
||||
background-color: none;
|
||||
border-image: none;
|
||||
margin: 5px;
|
||||
#code_file #snippet_button {
|
||||
border-image: url(data/gui/code_view/images/snippet_inactive.png);
|
||||
}
|
||||
|
||||
#code_area #maximize_button:enabled {
|
||||
border-image: url(data/gui/code_view/images/button_maximize.png);
|
||||
#code_file #snippet_button:enabled {
|
||||
border-image: url(data/gui/code_view/images/snippet_active.png);
|
||||
}
|
||||
|
||||
#code_file #minimize_button {
|
||||
border-image: url(data/gui/code_view/images/minimize_inactive.png);
|
||||
}
|
||||
|
||||
#code_file #minimize_button:enabled {
|
||||
border-image: url(data/gui/code_view/images/minimize_active.png);
|
||||
}
|
||||
|
||||
QToolTip {
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 30 KiB |
@@ -49,7 +49,6 @@ QtCodeArea::QtCodeArea(
|
||||
)
|
||||
: QPlainTextEdit(parent)
|
||||
, m_fileWidget(file)
|
||||
, m_maximizeButton(nullptr)
|
||||
, m_startLineNumber(startLineNumber)
|
||||
, m_hoveredAnnotation(nullptr)
|
||||
, m_digits(0)
|
||||
@@ -91,27 +90,10 @@ QtCodeArea::~QtCodeArea()
|
||||
QSize QtCodeArea::sizeHint() const
|
||||
{
|
||||
int width = 480;
|
||||
int height = (document()->size().height() + 0.7f) * fontMetrics().lineSpacing();
|
||||
int height = (document()->size().height() + 0.7f) * fontMetrics().lineSpacing() - 3;
|
||||
return QSize(width, height);
|
||||
}
|
||||
|
||||
void QtCodeArea::addMaximizeButton()
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout();
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
setLayout(layout);
|
||||
|
||||
m_maximizeButton = new QPushButton(this);
|
||||
m_maximizeButton->setObjectName("maximize_button");
|
||||
m_maximizeButton->setEnabled(false);
|
||||
layout->addWidget(m_maximizeButton);
|
||||
layout->setAlignment(m_maximizeButton, Qt::AlignRight);
|
||||
|
||||
connect(m_maximizeButton, SIGNAL(clicked()), this, SLOT(clickedMaximizeButton()));
|
||||
}
|
||||
|
||||
void QtCodeArea::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(m_lineNumberArea);
|
||||
@@ -185,7 +167,7 @@ void QtCodeArea::showEvent(QShowEvent* event)
|
||||
void QtCodeArea::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QPainter painter(viewport());
|
||||
painter.fillRect(rect(), Qt::white);
|
||||
// painter.fillRect(rect(), Qt::white);
|
||||
|
||||
QTextBlock block = firstVisibleBlock();
|
||||
int top = blockBoundingGeometry(block).translated(contentOffset()).top();
|
||||
@@ -216,19 +198,10 @@ void QtCodeArea::paintEvent(QPaintEvent* event)
|
||||
|
||||
void QtCodeArea::enterEvent(QEvent* event)
|
||||
{
|
||||
if (m_maximizeButton)
|
||||
{
|
||||
m_maximizeButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeArea::leaveEvent(QEvent* event)
|
||||
{
|
||||
if (m_maximizeButton)
|
||||
{
|
||||
m_maximizeButton->setEnabled(false);
|
||||
}
|
||||
|
||||
setHoveredAnnotation(nullptr);
|
||||
}
|
||||
|
||||
@@ -239,7 +212,7 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event)
|
||||
QTextCursor cursor = this->cursorForPosition(event->pos());
|
||||
const Annotation* annotation = findAnnotationForPosition(cursor.position());
|
||||
|
||||
if (annotation)
|
||||
if (annotation && !annotation->isScope)
|
||||
{
|
||||
MessageActivateTokenLocation(annotation->locationId).dispatch();
|
||||
}
|
||||
@@ -248,9 +221,9 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event)
|
||||
|
||||
void QtCodeArea::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && m_maximizeButton)
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
clickedMaximizeButton();
|
||||
MessageShowFile(m_fileWidget->getFilePath().absoluteStr(), m_startLineNumber, m_startLineNumber + blockCount() - 1).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,11 +276,6 @@ void QtCodeArea::updateLineNumberArea(const QRect &rect, int dy)
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeArea::clickedMaximizeButton()
|
||||
{
|
||||
MessageShowFile(m_fileWidget->getFilePath().absoluteStr(), m_startLineNumber, m_startLineNumber + blockCount() - 1).dispatch();
|
||||
}
|
||||
|
||||
void QtCodeArea::clearSelection()
|
||||
{
|
||||
QTextCursor cursor = textCursor();
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "utility/types.h"
|
||||
|
||||
class QPaintEvent;
|
||||
class QPushButton;
|
||||
class QResizeEvent;
|
||||
class QSize;
|
||||
class QtCodeFile;
|
||||
@@ -19,12 +18,14 @@ class QWidget;
|
||||
class TokenLocation;
|
||||
class TokenLocationFile;
|
||||
|
||||
class QtCodeArea: public QPlainTextEdit
|
||||
class QtCodeArea
|
||||
: public QPlainTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
class LineNumberArea: public QWidget
|
||||
class LineNumberArea
|
||||
: public QWidget
|
||||
{
|
||||
public:
|
||||
LineNumberArea(QtCodeArea *codeArea);
|
||||
@@ -50,8 +51,6 @@ public:
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
void addMaximizeButton();
|
||||
|
||||
void lineNumberAreaPaintEvent(QPaintEvent *event);
|
||||
int lineNumberDigits() const;
|
||||
int lineNumberAreaWidth() const;
|
||||
@@ -72,7 +71,6 @@ protected:
|
||||
private slots:
|
||||
void updateLineNumberAreaWidth(int newBlockCount);
|
||||
void updateLineNumberArea(const QRect &, int);
|
||||
void clickedMaximizeButton();
|
||||
void clearSelection();
|
||||
|
||||
private:
|
||||
@@ -113,8 +111,6 @@ private:
|
||||
QWidget* m_lineNumberArea;
|
||||
QtHighlighter* m_highlighter;
|
||||
|
||||
QPushButton* m_maximizeButton;
|
||||
|
||||
const uint m_startLineNumber;
|
||||
|
||||
std::vector<Annotation> m_annotations;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "qt/element/QtCodeSnippet.h"
|
||||
|
||||
QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeFileList* parent)
|
||||
: QWidget(parent)
|
||||
: QFrame(parent)
|
||||
, m_parent(parent)
|
||||
, m_filePath(filePath)
|
||||
{
|
||||
@@ -23,11 +23,15 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeFileList* parent)
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
setLayout(layout);
|
||||
|
||||
QFrame* titleWidget = new QFrame(this);
|
||||
titleWidget->setObjectName("title_widget");
|
||||
layout->addWidget(titleWidget);
|
||||
|
||||
QHBoxLayout* titleLayout = new QHBoxLayout();
|
||||
titleLayout->setMargin(0);
|
||||
titleLayout->setSpacing(0);
|
||||
titleLayout->setAlignment(Qt::AlignLeft);
|
||||
layout->addLayout(titleLayout);
|
||||
titleWidget->setLayout(titleLayout);
|
||||
|
||||
m_title = new QPushButton(filePath.fileName().c_str(), this);
|
||||
m_title->setObjectName("title_label");
|
||||
@@ -41,17 +45,20 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeFileList* parent)
|
||||
titleLayout->addStretch(3);
|
||||
|
||||
m_minimizeButton = new QPushButton(this);
|
||||
m_minimizeButton->setObjectName("maximize_button");
|
||||
m_minimizeButton->setObjectName("minimize_button");
|
||||
m_minimizeButton->setToolTip("minimize file");
|
||||
m_minimizeButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
titleLayout->addWidget(m_minimizeButton);
|
||||
|
||||
m_snippetButton = new QPushButton(this);
|
||||
m_snippetButton->setObjectName("maximize_button");
|
||||
m_snippetButton->setObjectName("snippet_button");
|
||||
m_snippetButton->setToolTip("show snippets in file");
|
||||
m_snippetButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
titleLayout->addWidget(m_snippetButton);
|
||||
|
||||
m_maximizeButton = new QPushButton(this);
|
||||
m_maximizeButton->setObjectName("maximize_button");
|
||||
m_maximizeButton->setToolTip("maximize file");
|
||||
m_maximizeButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
titleLayout->addWidget(m_maximizeButton);
|
||||
|
||||
@@ -109,6 +116,7 @@ void QtCodeFile::addCodeSnippet(
|
||||
|
||||
if (locationFile->isWholeCopy)
|
||||
{
|
||||
snippet->setProperty("isFirst", true);
|
||||
m_fileSnippet = snippet;
|
||||
clickedMaximizeButton();
|
||||
return;
|
||||
@@ -116,9 +124,9 @@ void QtCodeFile::addCodeSnippet(
|
||||
|
||||
m_snippets.push_back(snippet);
|
||||
|
||||
if (m_parent->getShowMaximizeButton())
|
||||
if (m_snippets.size() == 1)
|
||||
{
|
||||
snippet->addMaximizeButton();
|
||||
snippet->setProperty("isFirst", true);
|
||||
}
|
||||
|
||||
int maxDigits = 1;
|
||||
@@ -146,8 +154,6 @@ void QtCodeFile::updateContent()
|
||||
{
|
||||
m_fileSnippet->updateContent();
|
||||
}
|
||||
|
||||
m_title->setEnabled(m_parent->getShowMaximizeButton());
|
||||
}
|
||||
|
||||
void QtCodeFile::clickedTitle()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QFrame>
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/types.h"
|
||||
@@ -16,7 +16,7 @@ class QtCodeSnippet;
|
||||
class TokenLocationFile;
|
||||
|
||||
class QtCodeFile
|
||||
: public QWidget
|
||||
: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -3,27 +3,26 @@
|
||||
#include <QScrollBar>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
|
||||
#include "data/location/TokenLocationFile.h"
|
||||
#include "qt/element/QtCodeFile.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
|
||||
QtCodeFileList::QtCodeFileList(QWidget* parent)
|
||||
: QScrollArea(parent)
|
||||
, m_focusedTokenId(0)
|
||||
, m_showMaximizeButton(true)
|
||||
{
|
||||
m_frame = std::make_shared<QFrame>(this);
|
||||
m_frame->setObjectName("code_file_list");
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(m_frame.get());
|
||||
layout->setSpacing(10);
|
||||
layout->setContentsMargins(15, 15, 15, 15);
|
||||
layout->setSpacing(8);
|
||||
layout->setContentsMargins(8, 8, 8, 8);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
m_frame->setLayout(layout);
|
||||
|
||||
setWidgetResizable(true);
|
||||
setWidget(m_frame.get());
|
||||
|
||||
setObjectName("code_file_list");
|
||||
}
|
||||
|
||||
QtCodeFileList::~QtCodeFileList()
|
||||
@@ -98,17 +97,6 @@ void QtCodeFileList::setErrorMessages(const std::vector<std::string>& errorMessa
|
||||
updateFiles();
|
||||
}
|
||||
|
||||
bool QtCodeFileList::getShowMaximizeButton() const
|
||||
{
|
||||
return m_showMaximizeButton;
|
||||
}
|
||||
|
||||
void QtCodeFileList::setShowMaximizeButton(bool show)
|
||||
{
|
||||
m_showMaximizeButton = show;
|
||||
updateFiles();
|
||||
}
|
||||
|
||||
void QtCodeFileList::updateFiles()
|
||||
{
|
||||
for (std::shared_ptr<QtCodeFile> file: m_files)
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
class QtCodeFile;
|
||||
class TokenLocationFile;
|
||||
|
||||
class QtCodeFileList: public QScrollArea
|
||||
class QtCodeFileList
|
||||
: public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -39,9 +40,6 @@ public:
|
||||
const std::vector<std::string>& getErrorMessages() const;
|
||||
void setErrorMessages(const std::vector<std::string>& errorMessages);
|
||||
|
||||
bool getShowMaximizeButton() const;
|
||||
void setShowMaximizeButton(bool show);
|
||||
|
||||
void focusToken(Id tokenId);
|
||||
void defocusToken();
|
||||
|
||||
@@ -54,7 +52,6 @@ private:
|
||||
Id m_focusedTokenId;
|
||||
std::vector<Id> m_activeTokenIds;
|
||||
std::vector<std::string> m_errorMessages;
|
||||
bool m_showMaximizeButton;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FILE_LIST
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "qt/element/QtCodeSnippet.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "qt/element/QtCodeFile.h"
|
||||
@@ -12,7 +12,9 @@ QtCodeSnippet::QtCodeSnippet(
|
||||
std::shared_ptr<TokenLocationFile> locationFile,
|
||||
QtCodeFile* file
|
||||
)
|
||||
: QWidget(file)
|
||||
: QFrame(file)
|
||||
, m_dots(nullptr)
|
||||
, m_title(nullptr)
|
||||
, m_codeArea(std::make_shared<QtCodeArea>(startLineNumber, code, locationFile, file, this))
|
||||
{
|
||||
setObjectName("code_snippet");
|
||||
@@ -23,25 +25,35 @@ QtCodeSnippet::QtCodeSnippet(
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
setLayout(layout);
|
||||
|
||||
m_title = new QPushButton(title.c_str(), this);
|
||||
m_title->setObjectName("title_label");
|
||||
m_title->minimumSizeHint(); // force font loading
|
||||
m_title->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_title->setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Fixed);
|
||||
layout->addWidget(m_title);
|
||||
if (title.size())
|
||||
{
|
||||
QHBoxLayout* titleLayout = new QHBoxLayout();
|
||||
titleLayout->setMargin(0);
|
||||
titleLayout->setSpacing(0);
|
||||
titleLayout->setAlignment(Qt::AlignLeft);
|
||||
layout->addLayout(titleLayout);
|
||||
|
||||
m_dots = new QPushButton(this);
|
||||
m_dots->setObjectName("dots");
|
||||
m_dots->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
titleLayout->addWidget(m_dots);
|
||||
|
||||
m_title = new QPushButton(title.c_str(), this);
|
||||
m_title->setObjectName("scope_name");
|
||||
m_title->minimumSizeHint(); // force font loading
|
||||
m_title->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_title->setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Fixed);
|
||||
titleLayout->addWidget(m_title);
|
||||
}
|
||||
|
||||
layout->addWidget(m_codeArea.get());
|
||||
updateDots();
|
||||
}
|
||||
|
||||
QtCodeSnippet::~QtCodeSnippet()
|
||||
{
|
||||
}
|
||||
|
||||
void QtCodeSnippet::addMaximizeButton()
|
||||
{
|
||||
m_codeArea->addMaximizeButton();
|
||||
}
|
||||
|
||||
int QtCodeSnippet::lineNumberDigits() const
|
||||
{
|
||||
return m_codeArea->lineNumberDigits();
|
||||
@@ -50,9 +62,22 @@ int QtCodeSnippet::lineNumberDigits() const
|
||||
void QtCodeSnippet::updateLineNumberAreaWidthForDigits(int digits)
|
||||
{
|
||||
m_codeArea->updateLineNumberAreaWidthForDigits(digits);
|
||||
updateDots();
|
||||
}
|
||||
|
||||
void QtCodeSnippet::updateContent()
|
||||
{
|
||||
m_codeArea->updateContent();
|
||||
updateDots();
|
||||
}
|
||||
|
||||
void QtCodeSnippet::updateDots()
|
||||
{
|
||||
if (!m_dots)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_dots->setText(QString::fromStdString(std::string(lineNumberDigits(), '.')));
|
||||
m_dots->setMinimumWidth(m_codeArea->lineNumberAreaWidth());
|
||||
}
|
||||
|
||||
@@ -4,14 +4,18 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
#include "utility/types.h"
|
||||
|
||||
#include "qt/element/QtCodeArea.h"
|
||||
|
||||
class QPushButton;
|
||||
class QtCodeFile;
|
||||
class QWidget;
|
||||
class TokenLocationFile;
|
||||
|
||||
class QtCodeSnippet: public QWidget
|
||||
class QtCodeSnippet
|
||||
: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -25,14 +29,15 @@ public:
|
||||
);
|
||||
virtual ~QtCodeSnippet();
|
||||
|
||||
void addMaximizeButton();
|
||||
|
||||
int lineNumberDigits() const;
|
||||
|
||||
void updateLineNumberAreaWidthForDigits(int digits);
|
||||
void updateContent();
|
||||
|
||||
private:
|
||||
void updateDots();
|
||||
|
||||
QPushButton* m_dots;
|
||||
QPushButton* m_title;
|
||||
std::shared_ptr<QtCodeArea> m_codeArea;
|
||||
};
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "qt/view/QtCodeView.h"
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
|
||||
#include "qt/element/QtCodeFileList.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
|
||||
QtCodeView::QtCodeView(ViewLayout* viewLayout)
|
||||
: CodeView(viewLayout)
|
||||
@@ -66,7 +67,6 @@ void QtCodeView::doShowCodeSnippets(const std::vector<CodeSnippetParams>& snippe
|
||||
|
||||
m_widget->setActiveTokenIds(m_activeTokenIds);
|
||||
m_widget->setErrorMessages(m_errorMessages);
|
||||
m_widget->setShowMaximizeButton(m_errorMessages.size() == 0);
|
||||
|
||||
for (const CodeSnippetParams& params : snippets)
|
||||
{
|
||||
@@ -79,18 +79,6 @@ void QtCodeView::doShowCodeFile(const CodeSnippetParams& params)
|
||||
m_widget->addCodeSnippet(1, params.title, params.code, params.locationFile);
|
||||
}
|
||||
|
||||
std::shared_ptr<QtCodeFileList> QtCodeView::createQtCodeFileList() const
|
||||
{
|
||||
std::shared_ptr<QtCodeFileList> ptr = std::make_shared<QtCodeFileList>();
|
||||
setStyleSheet(ptr.get());
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void QtCodeView::setStyleSheet(QWidget* widget) const
|
||||
{
|
||||
widget->setStyleSheet(TextAccess::createFromFile("data/gui/code_view/code_view.css")->getText().c_str());
|
||||
}
|
||||
|
||||
void QtCodeView::focusToken(const Id tokenId)
|
||||
{
|
||||
m_focusTokenFunctor(tokenId);
|
||||
@@ -110,3 +98,8 @@ void QtCodeView::doDefocusToken()
|
||||
{
|
||||
m_widget->defocusToken();
|
||||
}
|
||||
|
||||
void QtCodeView::setStyleSheet(QWidget* widget) const
|
||||
{
|
||||
widget->setStyleSheet(TextAccess::createFromFile("data/gui/code_view/code_view.css")->getText().c_str());
|
||||
}
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "utility/types.h"
|
||||
|
||||
#include "component/view/CodeView.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
class QFrame;
|
||||
class QtCodeFileList;
|
||||
class QWidget;
|
||||
|
||||
class QtCodeView: public CodeView
|
||||
class QtCodeView
|
||||
: public CodeView
|
||||
{
|
||||
public:
|
||||
QtCodeView(ViewLayout* viewLayout);
|
||||
@@ -35,13 +37,13 @@ public:
|
||||
|
||||
private:
|
||||
void doRefreshView();
|
||||
|
||||
void doShowCodeSnippets(const std::vector<CodeSnippetParams>& snippets);
|
||||
void doShowCodeFile(const CodeSnippetParams& params);
|
||||
|
||||
void doFocusToken(const Id tokenId);
|
||||
void doDefocusToken();
|
||||
|
||||
std::shared_ptr<QtCodeFileList> createQtCodeFileList() const;
|
||||
|
||||
void setStyleSheet(QWidget* widget) const;
|
||||
|
||||
QtThreadedFunctor<> m_refreshViewFunctor;
|
||||
|
||||