ui & logic: fixes for release

* smaller indexing progress dialog with bar in the middle instead of golden ratio
* set default code snippet expand range to 3
* no minimum height for project file location element in project setup wizard
* move aggregation and inheritance edges to front when hovered or active
* push parent nodes of active nodes to back to make edges to the active child visible
* properly quit application when window is closed while confirm box is open
* properly quit application when window is closed while indexing
* only count top level nodes for count on bundle nodes
* give noLetterScore to index 0 in search index scoring

bug id = 121
This commit is contained in:
Eberhard Graether
2016-10-11 15:38:44 +02:00
parent 86f652d221
commit f6ae1afdb2
16 changed files with 93 additions and 44 deletions
+2 -1
View File
@@ -290,6 +290,7 @@ add_files(
utility/messaging/type/MessageStatus.h
utility/messaging/type/MessageSwitchColorScheme.h
utility/messaging/type/MessageUndo.h
utility/messaging/type/MessageWindowClosed.h
utility/messaging/type/MessageWindowFocus.h
utility/messaging/type/MessageZoom.h
@@ -334,7 +335,7 @@ add_files(
utility/solution/SolutionParserUtility.h
utility/solution/SolutionParserVisualStudio.cpp
utility/solution/SolutionParserVisualStudio.h
utility/synchronization/ReaderWriterLock.cpp
utility/synchronization/ReaderWriterLock.h
utility/synchronization/ScopedReaderLock.cpp
@@ -742,7 +742,7 @@ void GraphController::bundleNodesAndEdgesMatching(
node->visible = false;
bundleNode->bundledNodes.push_back(node);
bundleNode->bundledNodeCount += node->getConnectedSubNodeCount();
bundleNode->bundledNodeCount += node->getBundledNodeCount();
m_dummyNodes.erase(m_dummyNodes.begin() + matchedNodeIndices[i]);
}
@@ -140,23 +140,6 @@ public:
return false;
}
size_t getConnectedSubNodeCount() const
{
size_t count = 0;
if (connected)
{
count += 1;
}
for (std::shared_ptr<DummyNode> node : subNodes)
{
count += node->getConnectedSubNodeCount();
}
return count;
}
std::vector<const DummyNode*> getConnectedSubNodes() const
{
std::vector<const DummyNode*> nodes;
+2 -2
View File
@@ -455,7 +455,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ
style.originOffset.y = 0;
style.targetOffset.y = 0;
style.verticalOffset = 0;
style.zValue = isActive ? -2 : -5;
style.zValue = isActive ? 1 : -5;
break;
case Edge::EDGE_CALL:
style.originOffset.y = 1;
@@ -472,7 +472,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ
style.arrowWidth = 14;
style.arrowClosed = true;
style.targetOffset.x = 34;
style.zValue = isActive ? -1 : -3;
style.zValue = isActive ? 2 : -3;
break;
default:
break;
+1 -1
View File
@@ -402,7 +402,7 @@ int SearchIndex::score(const std::string& text, const std::vector<size_t>& indic
}
// after no letter
bool prevIsNoLetter = (index > 0 && noLetters.find(text[index - 1]) != noLetters.end());
bool prevIsNoLetter = (index == 0 || noLetters.find(text[index - 1]) != noLetters.end());
if (prevIsNoLetter)
{
noLetterScore += noLetterBonus;
+1 -1
View File
@@ -261,7 +261,7 @@ void ApplicationSettings::setCodeSnippetSnapRange(int range)
int ApplicationSettings::getCodeSnippetExpandRange() const
{
return getValue<int>("code/snippet/expand_range", 2);
return getValue<int>("code/snippet/expand_range", 3);
}
void ApplicationSettings::setCodeSnippetExpandRange(int range)
@@ -0,0 +1,21 @@
#ifndef MESSAGE_WINDOW_CLOSED_H
#define MESSAGE_WINDOW_CLOSED_H
#include "utility/messaging/Message.h"
class MessageWindowClosed
: public Message<MessageWindowClosed>
{
public:
MessageWindowClosed()
{
setSendAsTask(false);
}
static const std::string getStaticType()
{
return "MessageWindowClosed";
}
};
#endif // MESSAGE_WINDOW_CLOSED_H
@@ -38,6 +38,9 @@ void TaskGroupParallel::doEnter(std::shared_ptr<Blackboard> blackboard)
Task::TaskState TaskGroupParallel::doUpdate(std::shared_ptr<Blackboard> blackboard)
{
const int SLEEP_TIME_MS = 25;
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
if (m_tasks.size() != 0 && getActveTaskCount() > 0)
{
return STATE_RUNNING;
@@ -72,8 +75,6 @@ void TaskGroupParallel::doReset(std::shared_ptr<Blackboard> blackboard)
void TaskGroupParallel::processTaskThreaded(std::shared_ptr<TaskInfo> taskInfo, std::shared_ptr<Blackboard> blackboard)
{
const int SLEEP_TIME_MS = 25;
ScopedFunctor functor([&](){
std::lock_guard<std::mutex> lock(m_activeTaskCountMutex);
m_activeTaskCount--;
@@ -92,8 +93,6 @@ void TaskGroupParallel::processTaskThreaded(std::shared_ptr<TaskInfo> taskInfo,
taskInfo->active = false;
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
}
}
+10 -2
View File
@@ -48,8 +48,6 @@ void TaskScheduler::startSchedulerLoopThreaded()
void TaskScheduler::startSchedulerLoop()
{
const int SLEEP_TIME_MS = 25;
{
std::lock_guard<std::mutex> lock(m_loopMutex);
@@ -75,6 +73,7 @@ void TaskScheduler::startSchedulerLoop()
}
}
const int SLEEP_TIME_MS = 25;
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
}
@@ -156,6 +155,15 @@ void TaskScheduler::processTasks()
{
break;
}
{
std::lock_guard<std::mutex> lock(m_loopMutex);
if (!m_loopIsRunning)
{
break;
}
}
}
}
+15 -8
View File
@@ -14,11 +14,13 @@
QtDialogView::QtDialogView(QtMainWindow* mainWindow)
: m_mainWindow(mainWindow)
, m_windowStack(this)
, m_resultReady(false)
{
}
QtDialogView::~QtDialogView()
{
m_resultReady = true;
}
void QtDialogView::showProgressDialog(const std::string& title, const std::string& message)
@@ -66,17 +68,17 @@ void QtDialogView::hideProgressDialog()
bool QtDialogView::startIndexingDialog(size_t cleanFileCount, size_t indexFileCount)
{
bool result = false;
bool done = false;
m_resultReady = false;
m_onQtThread(
[=, &result, &done]()
[=, &result]()
{
QtIndexingDialog* window = createWindow<QtIndexingDialog>();
window->setupStart(cleanFileCount, indexFileCount,
[&](bool start)
{
result = start;
done = true;
m_resultReady = true;
setUIBlocked(false);
}
@@ -86,7 +88,7 @@ bool QtDialogView::startIndexingDialog(size_t cleanFileCount, size_t indexFileCo
}
);
while (!done)
while (!m_resultReady)
{
const int SLEEP_TIME_MS = 25;
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
@@ -155,10 +157,10 @@ void QtDialogView::finishedIndexingDialog(size_t fileCount, size_t totalFileCoun
int QtDialogView::confirm(const std::string& message, const std::vector<std::string>& options)
{
int result = -1;
bool done = false;
m_resultReady = false;
m_onQtThread(
[=, &result, &done]()
[=, &result]()
{
QMessageBox msgBox;
msgBox.setText(message.c_str());
@@ -179,11 +181,11 @@ int QtDialogView::confirm(const std::string& message, const std::vector<std::str
}
}
done = true;
m_resultReady = true;
}
);
while (!done)
while (!m_resultReady)
{
const int SLEEP_TIME_MS = 25;
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
@@ -218,6 +220,11 @@ void QtDialogView::handleMessage(MessageShowErrors* message)
);
}
void QtDialogView::handleMessage(MessageWindowClosed* message)
{
m_resultReady = true;
}
void QtDialogView::updateErrorCount(size_t errorCount, size_t fatalCount)
{
QtIndexingDialog* window = dynamic_cast<QtIndexingDialog*>(m_windowStack.getTopWindow());
+5
View File
@@ -9,6 +9,7 @@
#include "utility/messaging/MessageListener.h"
#include "utility/messaging/type/MessageInterruptTasks.h"
#include "utility/messaging/type/MessageShowErrors.h"
#include "utility/messaging/type/MessageWindowClosed.h"
class QtMainWindow;
@@ -17,6 +18,7 @@ class QtDialogView
, public DialogView
, public MessageListener<MessageInterruptTasks>
, public MessageListener<MessageShowErrors>
, public MessageListener<MessageWindowClosed>
{
Q_OBJECT
@@ -36,6 +38,7 @@ public:
private:
void handleMessage(MessageInterruptTasks* message) override;
void handleMessage(MessageShowErrors* message) override;
void handleMessage(MessageWindowClosed* message) override;
void updateErrorCount(size_t errorCount, size_t fatalCount);
@@ -50,6 +53,8 @@ private:
QtThreadedLambdaFunctor m_onQtThread;
QtThreadedLambdaFunctor m_onQtThread2;
bool m_resultReady;
};
#endif // QT_DIALOG_VIEW_H
@@ -258,6 +258,25 @@ Id QtGraphNode::getTokenId() const
void QtGraphNode::addSubNode(const std::shared_ptr<QtGraphNode>& node)
{
m_subNodes.push_back(node);
// push parent nodes to back so all edges going to the active subnode are visible
if (node->getIsActive())
{
QtGraphNode* parent = this;
while (parent)
{
parent->setZValue(-10.0f);
parent->m_rect->setZValue(-10.0f);
parent->m_text->setZValue(-9.0f);
if (parent->m_undefinedRect)
{
parent->m_undefinedRect->setZValue(-10.0f);
}
parent = parent->getParent();
}
}
}
void QtGraphNode::moved(const Vec2i& oldPosition)
+6 -6
View File
@@ -74,13 +74,13 @@ void QtIndexingDialog::setupProgress()
QBoxLayout* layout = createLayout();
addTopAndProgressBar(0.62);
addTopAndProgressBar(0.5);
addTitle("Clearing", layout);
addMessageLabel(layout);
layout->addStretch();
m_sizeHint = QSize(350, 350);
m_sizeHint = QSize(350, 280);
m_progressBar->showUnknownProgressAnimated();
@@ -268,12 +268,12 @@ void QtIndexingDialog::addTopAndProgressBar(float topRatio)
m_top = new QWidget(m_window);
m_top->setObjectName("topHalf");
m_top->setGeometry(0, 0, m_window->size().width(), m_window->size().height() * topRatio);
m_top->setGeometry(0, 0, 0, 0);
m_top->show();
m_top->lower();
m_progressBar = new QtProgressBar(m_window);
m_progressBar->setGeometry(0, m_window->size().height() * topRatio - 5, m_window->size().width(), 10);
m_progressBar->setGeometry(0, 0, 0, 0);
}
void QtIndexingDialog::addTitle(QString title, QBoxLayout* layout)
@@ -393,7 +393,7 @@ void QtIndexingDialog::setGeometries()
void QtIndexingDialog::finishSetup()
{
setGeometries();
setupDone();
setGeometries();
}
+6
View File
@@ -36,6 +36,7 @@
#include "utility/messaging/type/MessageResetZoom.h"
#include "utility/messaging/type/MessageSearch.h"
#include "utility/messaging/type/MessageUndo.h"
#include "utility/messaging/type/MessageWindowClosed.h"
#include "utility/messaging/type/MessageWindowFocus.h"
#include "utility/messaging/type/MessageZoom.h"
#include "utility/ResourcePaths.h"
@@ -314,6 +315,11 @@ void QtMainWindow::contextMenuEvent(QContextMenuEvent* event)
QtContextMenu::getInstance()->showDefault(event, this);
}
void QtMainWindow::closeEvent(QCloseEvent* event)
{
MessageWindowClosed().dispatch();
}
void QtMainWindow::about()
{
QtAbout* aboutWindow = createWindow<QtAbout>();
+1
View File
@@ -91,6 +91,7 @@ protected:
bool event(QEvent* event);
void keyPressEvent(QKeyEvent* event);
void contextMenuEvent(QContextMenuEvent* event);
void closeEvent(QCloseEvent* event);
public slots:
void about();
@@ -138,7 +138,6 @@ void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& r
layout->addWidget(locationLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL);
layout->setRowMinimumHeight(row, 50);
row++;
}