ui: usability fixes

* reduced mouse drag sensibility when clicking on graph nodes
* also edit search element when cursor in front and pressing DELETE
* scroll to up to minimized snippet after minimizing when scrolled down far
This commit is contained in:
Eberhard Graether
2019-06-28 12:43:31 +02:00
parent 841a87469b
commit 5cc39824e0
7 changed files with 35 additions and 43 deletions
@@ -295,7 +295,13 @@ void QtCodeFileList::setFileMinimized(const FilePath path)
}
else
{
getFile(path)->setMinimized();
QtCodeFile* file = getFile(path);
file->setMinimized();
if (m_firstSnippetTitleBar->isVisible())
{
ensureWidgetVisibleAnimated(m_filesArea, file->getTitleBar(), QRect(), false, SCROLL_TOP);
}
}
}
@@ -301,11 +301,11 @@ void QtSmartSearchBox::keyPressEvent(QKeyEvent* event)
}
else if (!hasSelectedText() && cursorPosition() == text().size() && m_cursorIndex < m_elements.size())
{
m_elements[m_cursorIndex]->setChecked(true);
deleteSelectedElements();
editElement(m_elements[m_cursorIndex]);
setCursorPosition(0);
return;
}
else
else if (event->matches(QKeySequence::DeleteStartOfWord))
{
std::string str = text().toStdString();
std::smatch match;
@@ -35,7 +35,7 @@ void QtGraphNodeComponentClickable::nodeMouseMoveEvent(QGraphicsSceneMouseEvent*
{
Vec2i mousePos = Vec2i(event->scenePos().x(), event->scenePos().y());
if ((mousePos - m_mousePos).getLength() > 1.0f)
if ((mousePos - m_mousePos).getLength() > 3.0f)
{
m_mouseMoved = true;
}
+4 -20
View File
@@ -2,31 +2,15 @@
#include <set>
#include "Application.h"
#include "ApplicationSettings.h"
#include "JavaEnvironment.h"
#include "JavaEnvironmentFactory.h"
#include "ApplicationSettings.h"
#include "logging.h"
#include "MessageStatus.h"
#include "ResourcePaths.h"
#include "utilityJava.h"
#include "utilityString.h"
#include "Application.h"
namespace
{
void setJavaHomeVariableIfNotExists()
{
if (getenv("JAVA_HOME") == nullptr)
{
const FilePath javaPath = ApplicationSettings::getInstance()->getJavaPath();
const FilePath javaHomePath = javaPath.getParentDirectory().getParentDirectory().getParentDirectory();
LOG_WARNING("Environment variable \"JAVA_HOME\" not found on system. Setting value to \"" + javaHomePath.str() + "\" for this process.");
putenv(const_cast<char*>(("JAVA_HOME=" + javaHomePath.str()).c_str()));
}
}
}
namespace utility
{
@@ -34,7 +18,7 @@ namespace utility
{
const FilePath gradleInitScriptPath = ResourcePaths::getJavaPath().concatenate(L"gradle/init.gradle");
setJavaHomeVariableIfNotExists();
utility::setJavaHomeVariableIfNotExists();
utility::prepareJavaEnvironment();
std::shared_ptr<JavaEnvironment> javaEnvironment = JavaEnvironmentFactory::getInstance()->createEnvironment();
@@ -64,7 +48,7 @@ namespace utility
{
const FilePath gradleInitScriptPath = ResourcePaths::getJavaPath().concatenate(L"gradle/init.gradle");
setJavaHomeVariableIfNotExists();
utility::setJavaHomeVariableIfNotExists();
utility::prepareJavaEnvironment();
std::set<std::wstring> uncheckedDirectories;
+13
View File
@@ -182,4 +182,17 @@ namespace utility
return classPath;
}
void setJavaHomeVariableIfNotExists()
{
if (getenv("JAVA_HOME") == nullptr)
{
const FilePath javaPath = ApplicationSettings::getInstance()->getJavaPath();
const FilePath javaHomePath = javaPath.getParentDirectory().getParentDirectory().getParentDirectory();
LOG_WARNING("Environment variable \"JAVA_HOME\" not found on system. Setting value to \"" + javaHomePath.str() + "\" for this process.");
putenv(const_cast<char*>(("JAVA_HOME=" + javaHomePath.str()).c_str()));
}
}
}
+1
View File
@@ -18,6 +18,7 @@ namespace utility
const std::vector<FilePath>& classpathItems,
bool useJreSystemLibrary,
const std::set<FilePath>& sourceFilePaths);
void setJavaHomeVariableIfNotExists();
}
#endif // UTILITY_JAVA_H
+6 -18
View File
@@ -2,15 +2,16 @@
#include <cstdlib>
#include "Application.h"
#include "ApplicationSettings.h"
#include "FilePath.h"
#include "MessageStatus.h"
#include "TextAccess.h"
#include "utility.h"
#include "utilityApp.h"
#include "utilityJava.h"
#include "utilityString.h"
#include "utilityXml.h"
#include "utility.h"
#include "Application.h"
namespace
{
@@ -49,19 +50,6 @@ namespace
}
}
void setJavaHomeVariableIfNotExists()
{
if (getenv("JAVA_HOME") == nullptr)
{
const FilePath javaPath = ApplicationSettings::getInstance()->getJavaPath();
const FilePath javaHomePath = javaPath.getParentDirectory().getParentDirectory().getParentDirectory();
LOG_WARNING("Environment variable \"JAVA_HOME\" not found on system. Setting value to \"" + javaHomePath.str() + "\" for this process.");
putenv(const_cast<char*>(("JAVA_HOME=" + javaHomePath.str()).c_str()));
}
}
std::wstring getErrorMessageFromMavenOutput(std::shared_ptr<const TextAccess> mavenOutput)
{
const std::string errorPrefix = "[ERROR]";
@@ -96,7 +84,7 @@ namespace utility
{
std::wstring mavenGenerateSources(const FilePath& mavenPath, const FilePath& projectDirectoryPath)
{
setJavaHomeVariableIfNotExists();
utility::setJavaHomeVariableIfNotExists();
std::shared_ptr<TextAccess> outputAccess = TextAccess::createFromString(utility::executeProcessUntilNoOutput(
"\"" + mavenPath.str() + "\" generate-sources",
@@ -115,7 +103,7 @@ namespace utility
bool mavenCopyDependencies(const FilePath& mavenPath, const FilePath& projectDirectoryPath, const FilePath& outputDirectoryPath)
{
setJavaHomeVariableIfNotExists();
utility::setJavaHomeVariableIfNotExists();
std::shared_ptr<TextAccess> outputAccess = TextAccess::createFromString(utility::executeProcessUntilNoOutput(
"\"" + mavenPath.str() + "\" dependency:copy-dependencies -DoutputDirectory=" + outputDirectoryPath.str(),
@@ -137,7 +125,7 @@ namespace utility
std::vector<FilePath> mavenGetAllDirectoriesFromEffectivePom(
const FilePath& mavenPath, const FilePath& projectDirectoryPath, bool addTestDirectories)
{
setJavaHomeVariableIfNotExists();
utility::setJavaHomeVariableIfNotExists();
std::shared_ptr<TextAccess> outputAccess = TextAccess::createFromString(utility::executeProcessUntilNoOutput(
"\"" + mavenPath.str() + "\" help:effective-pom",