logic: multiple fixes and improvements
* showing project name in main window title * keep reference count visible when maximizing code file * show first node in db when no main function is available * log Storage stats after parse * fixed macro locations saved multiply * using NameHierarchy when retrieving ids
This commit is contained in:
@@ -136,7 +136,7 @@ void QtCodeFile::addCodeSnippet(
|
||||
Id titleId,
|
||||
const std::string& code,
|
||||
std::shared_ptr<TokenLocationFile> locationFile,
|
||||
uint refCount
|
||||
int refCount
|
||||
){
|
||||
m_locationFile.reset();
|
||||
|
||||
@@ -153,7 +153,10 @@ void QtCodeFile::addCodeSnippet(
|
||||
m_fileSnippet = snippet;
|
||||
|
||||
clickedMaximizeButton();
|
||||
updateRefCount(0);
|
||||
if (refCount != -1)
|
||||
{
|
||||
updateRefCount(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -169,7 +172,7 @@ QWidget* QtCodeFile::insertCodeSnippet(
|
||||
Id titleId,
|
||||
const std::string& code,
|
||||
std::shared_ptr<TokenLocationFile> locationFile,
|
||||
uint refCount
|
||||
int refCount
|
||||
){
|
||||
m_locationFile.reset();
|
||||
|
||||
@@ -271,7 +274,7 @@ void QtCodeFile::updateContent()
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFile::setLocationFile(std::shared_ptr<TokenLocationFile> locationFile, uint refCount)
|
||||
void QtCodeFile::setLocationFile(std::shared_ptr<TokenLocationFile> locationFile, int refCount)
|
||||
{
|
||||
m_locationFile = locationFile;
|
||||
clickedMinimizeButton();
|
||||
@@ -395,7 +398,7 @@ void QtCodeFile::updateSnippets()
|
||||
clickedSnippetButton();
|
||||
}
|
||||
|
||||
void QtCodeFile::updateRefCount(uint refCount)
|
||||
void QtCodeFile::updateRefCount(int refCount)
|
||||
{
|
||||
if (refCount > 0)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
Id titleId,
|
||||
const std::string& code,
|
||||
std::shared_ptr<TokenLocationFile> locationFile,
|
||||
uint refCount
|
||||
int refCount
|
||||
);
|
||||
|
||||
QWidget* insertCodeSnippet(
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
Id titleId,
|
||||
const std::string& code,
|
||||
std::shared_ptr<TokenLocationFile> locationFile,
|
||||
uint refCount
|
||||
int refCount
|
||||
);
|
||||
|
||||
QWidget* findFirstActiveSnippet() const;
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
void updateContent();
|
||||
|
||||
void setLocationFile(std::shared_ptr<TokenLocationFile> locationFile, uint refCount);
|
||||
void setLocationFile(std::shared_ptr<TokenLocationFile> locationFile, int refCount);
|
||||
|
||||
public slots:
|
||||
void clickedSnippetButton();
|
||||
@@ -68,7 +68,7 @@ private slots:
|
||||
|
||||
private:
|
||||
void updateSnippets();
|
||||
void updateRefCount(uint refCount);
|
||||
void updateRefCount(int refCount);
|
||||
|
||||
QtCodeFileList* m_parent;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ void QtCodeFileList::addCodeSnippet(
|
||||
Id titleId,
|
||||
const std::string& code,
|
||||
std::shared_ptr<TokenLocationFile> locationFile,
|
||||
uint refCount,
|
||||
int refCount,
|
||||
bool insert
|
||||
){
|
||||
QtCodeFile* file = getFile(locationFile);
|
||||
@@ -62,7 +62,7 @@ void QtCodeFileList::addCodeSnippet(
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileList::addFile(std::shared_ptr<TokenLocationFile> locationFile, uint refCount)
|
||||
void QtCodeFileList::addFile(std::shared_ptr<TokenLocationFile> locationFile, int refCount)
|
||||
{
|
||||
QtCodeFile* file = getFile(locationFile);
|
||||
file->setLocationFile(locationFile, refCount);
|
||||
|
||||
@@ -32,11 +32,11 @@ public:
|
||||
Id titleId,
|
||||
const std::string& code,
|
||||
std::shared_ptr<TokenLocationFile> locationFile,
|
||||
uint refCount,
|
||||
int refCount,
|
||||
bool insert = false
|
||||
);
|
||||
|
||||
void addFile(std::shared_ptr<TokenLocationFile> locationFile, uint refCount);
|
||||
void addFile(std::shared_ptr<TokenLocationFile> locationFile, int refCount);
|
||||
|
||||
void clearCodeSnippets();
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ void QtCodeView::doAddCodeSnippets(const std::vector<CodeSnippetParams>& snippet
|
||||
|
||||
void QtCodeView::doShowCodeFile(const CodeSnippetParams& params)
|
||||
{
|
||||
m_widget->addCodeSnippet(1, params.title, 0, params.code, params.locationFile, params.refCount);
|
||||
m_widget->addCodeSnippet(1, params.title, 0, params.code, params.locationFile, -1);
|
||||
}
|
||||
|
||||
void QtCodeView::doShowFirstActiveSnippet()
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "qt/window/QtMainWindow.h"
|
||||
|
||||
QtMainView::QtMainView()
|
||||
: m_setTitleFunctor(std::bind(&QtMainView::doSetTitle, this, std::placeholders::_1))
|
||||
{
|
||||
m_window = std::make_shared<QtMainWindow>();
|
||||
m_window->show();
|
||||
@@ -67,3 +68,13 @@ void QtMainView::showStartScreen()
|
||||
{
|
||||
m_window->showStartScreen();
|
||||
}
|
||||
|
||||
void QtMainView::setTitle(const std::string& title)
|
||||
{
|
||||
m_setTitleFunctor(title);
|
||||
}
|
||||
|
||||
void QtMainView::doSetTitle(const std::string& title)
|
||||
{
|
||||
m_window->setWindowTitle(QString::fromStdString(title));
|
||||
}
|
||||
|
||||
@@ -5,12 +5,15 @@
|
||||
#include <vector>
|
||||
|
||||
#include <QStatusBar>
|
||||
|
||||
#include "component/view/MainView.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
|
||||
class QtMainWindow;
|
||||
class View;
|
||||
|
||||
class QtMainView: public MainView
|
||||
class QtMainView
|
||||
: public MainView
|
||||
{
|
||||
public:
|
||||
QtMainView();
|
||||
@@ -31,10 +34,15 @@ public:
|
||||
|
||||
// MainView implementation
|
||||
virtual void showStartScreen();
|
||||
virtual void setTitle(const std::string& title);
|
||||
|
||||
private:
|
||||
void doSetTitle(const std::string& title);
|
||||
|
||||
std::shared_ptr<QtMainWindow> m_window;
|
||||
std::vector<View*> m_views;
|
||||
|
||||
QtThreadedFunctor<const std::string&> m_setTitleFunctor;
|
||||
};
|
||||
|
||||
#endif // QT_MAIN_VIEW_H
|
||||
|
||||
Reference in New Issue
Block a user