ui: fixes

* fixed first match in autocompletion not preselected
* fixed maximize file button extending snippets
* changed names of views and setting name of composite view
* fixed number of error locations
This commit is contained in:
Eberhard Graether
2015-09-10 15:49:28 +02:00
parent 4c0d749a39
commit eaa3fab4ec
13 changed files with 22 additions and 20 deletions
+2 -4
View File
@@ -205,6 +205,8 @@ void QtAutocompletionList::completeAt(const QPoint& pos, const std::vector<Searc
return;
}
setCompletionPrefix("");
const QModelIndex& index = completionModel()->index(0, 0);
list->setCurrentIndex(index);
@@ -212,16 +214,12 @@ void QtAutocompletionList::completeAt(const QPoint& pos, const std::vector<Searc
minSize.setHeight(std::min(minSize.height(), m_model->rowCount(index) * rect.height() + 16));
list->setMinimumSize(minSize);
list->verticalScrollBar()->setValue(list->verticalScrollBar()->minimum());
list->setCurrentIndex(index); // must be set again to avoid flickering
disconnect(); // must be done because of a bug where signals are no longer received by QtSmartSearchBox
connect(this, SIGNAL(highlighted(const QModelIndex&)), this, SLOT(onHighlighted(const QModelIndex&)), Qt::DirectConnection);
connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(onActivated(const QModelIndex&)), Qt::DirectConnection);
setCompletionPrefix("");
QWidget* textBox = dynamic_cast<QWidget*>(parent());
complete(QRect(pos.x(), pos.y(), textBox->width(), 1));
}
+2 -2
View File
@@ -6,8 +6,8 @@
#include "qt/view/QtViewWidgetWrapper.h"
#include "settings/ColorScheme.h"
QtCompositeView::QtCompositeView(ViewLayout* viewLayout, CompositeDirection direction)
: CompositeView(viewLayout, direction)
QtCompositeView::QtCompositeView(ViewLayout* viewLayout, CompositeDirection direction, const std::string& name)
: CompositeView(viewLayout, direction, name)
, m_refreshFunctor(std::bind(&QtCompositeView::doRefreshView, this))
{
QBoxLayout* layout;
+1 -1
View File
@@ -10,7 +10,7 @@ class QtCompositeView
: public CompositeView
{
public:
QtCompositeView(ViewLayout* viewLayout, CompositeDirection direction);
QtCompositeView(ViewLayout* viewLayout, CompositeDirection direction, const std::string& name);
~QtCompositeView();
// View implementation
+2 -2
View File
@@ -25,9 +25,9 @@ std::shared_ptr<MainView> QtViewFactory::createMainView() const
}
std::shared_ptr<CompositeView> QtViewFactory::createCompositeView(
ViewLayout* viewLayout, CompositeView::CompositeDirection direction
ViewLayout* viewLayout, CompositeView::CompositeDirection direction, const std::string& name
) const {
std::shared_ptr<CompositeView> ptr = std::make_shared<QtCompositeView>(viewLayout, direction);
std::shared_ptr<CompositeView> ptr = std::make_shared<QtCompositeView>(viewLayout, direction, name);
ptr->init();
ptr->addToLayout();
return ptr;
+1 -1
View File
@@ -11,7 +11,7 @@ public:
virtual std::shared_ptr<MainView> createMainView() const;
virtual std::shared_ptr<CompositeView> createCompositeView(
ViewLayout* viewLayout, CompositeView::CompositeDirection direction) const;
ViewLayout* viewLayout, CompositeView::CompositeDirection direction, const std::string& name) const;
virtual std::shared_ptr<CodeView> createCodeView(ViewLayout* viewLayout) const;
virtual std::shared_ptr<GraphView> createGraphView(ViewLayout* viewLayout) const;
+1 -1
View File
@@ -24,7 +24,7 @@ ComponentManager::~ComponentManager()
void ComponentManager::setup(ViewLayout* viewLayout)
{
std::shared_ptr<CompositeView> compositeView =
m_componentFactory->getViewFactory()->createCompositeView(viewLayout, CompositeView::DIRECTION_HORIZONTAL);
m_componentFactory->getViewFactory()->createCompositeView(viewLayout, CompositeView::DIRECTION_HORIZONTAL, "Search");
m_compositeViews.push_back(compositeView);
std::shared_ptr<Component> undoRedoComponent = m_componentFactory->createUndoRedoComponent(compositeView.get());
+1 -1
View File
@@ -77,7 +77,7 @@ CodeView::~CodeView()
std::string CodeView::getName() const
{
return "CodeView";
return "Code";
}
CodeController* CodeView::getController()
+3 -2
View File
@@ -1,8 +1,9 @@
#include "component/view/CompositeView.h"
CompositeView::CompositeView(ViewLayout* viewLayout, CompositeDirection direction)
CompositeView::CompositeView(ViewLayout* viewLayout, CompositeDirection direction, const std::string& name)
: View(viewLayout)
, m_direction(direction)
, m_name(name)
{
}
@@ -22,7 +23,7 @@ const std::vector<View*>& CompositeView::getViews() const
std::string CompositeView::getName() const
{
return "CompositeView";
return m_name;
}
void CompositeView::addView(View* view)
+2 -1
View File
@@ -17,7 +17,7 @@ public:
DIRECTION_VERTICAL
};
CompositeView(ViewLayout* viewLayout, CompositeDirection direction);
CompositeView(ViewLayout* viewLayout, CompositeDirection direction, const std::string& name);
virtual ~CompositeView();
CompositeDirection getDirection() const;
@@ -41,6 +41,7 @@ public:
private:
std::vector<View*> m_views;
CompositeDirection m_direction;
std::string m_name;
};
#endif // COMPOSITE_VIEW_H
+1 -1
View File
@@ -11,5 +11,5 @@ GraphView::~GraphView()
std::string GraphView::getName() const
{
return "GraphView";
return "Graph";
}
+1 -1
View File
@@ -13,7 +13,7 @@ SearchView::~SearchView()
std::string SearchView::getName() const
{
return "SearchView";
return "Search";
}
SearchController* SearchView::getController()
+1 -1
View File
@@ -22,7 +22,7 @@ public:
virtual std::shared_ptr<MainView> createMainView() const = 0;
virtual std::shared_ptr<CompositeView> createCompositeView(
ViewLayout* viewLayout, CompositeView::CompositeDirection direction) const = 0;
ViewLayout* viewLayout, CompositeView::CompositeDirection direction, const std::string& name) const = 0;
virtual std::shared_ptr<CodeView> createCodeView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<GraphView> createGraphView(ViewLayout* viewLayout) const = 0;
+4 -2
View File
@@ -105,7 +105,7 @@ void Storage::onError(const ParseLocation& location, const std::string& message)
Id errorId = m_errorMessages.size();
m_errorLocationCollection.addTokenLocation(
0, errorId, location.filePath,
getErrorCount(), errorId, location.filePath,
location.startLineNumber, location.startColumnNumber,
location.endLineNumber, location.endColumnNumber
);
@@ -798,7 +798,9 @@ TokenLocationCollection Storage::getTokenLocationsForLocationIds(const std::vect
std::shared_ptr<TokenLocationFile> Storage::getTokenLocationsForFile(const std::string& filePath) const
{
return m_sqliteStorage.getTokenLocationsForFile(filePath);
std::shared_ptr<TokenLocationFile> locationFile = m_sqliteStorage.getTokenLocationsForFile(filePath);
locationFile->isWholeCopy = true;
return locationFile;
}
std::shared_ptr<TokenLocationFile> Storage::getTokenLocationsForLinesInFile(