aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2024-03-26 11:16:07 +0100
committerTim Jenssen <tim.jenssen@qt.io>2024-03-26 15:59:34 +0100
commit8a1842317573d9f1ab9b3de29c244ed2f2f783ef (patch)
tree7983811693bdac3427b1fb166f2b6ab27367d8b4 /src/libs
parent4e63bcb744df8324551f28472ef6ff48d6bd1613 (diff)
parent7821fbbf03c31eed3d3aeea7839526187cabd5e7 (diff)
Merge remote-tracking branch 'origin/13.0' into qds/dev
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/solutions/tasking/tasktree.cpp54
-rw-r--r--src/libs/solutions/terminal/terminalview.cpp5
-rw-r--r--src/libs/utils/namevaluesdialog.cpp9
-rw-r--r--src/libs/utils/qtcprocess.cpp2
4 files changed, 40 insertions, 30 deletions
diff --git a/src/libs/solutions/tasking/tasktree.cpp b/src/libs/solutions/tasking/tasktree.cpp
index c6e87d2774..7d37bf9758 100644
--- a/src/libs/solutions/tasking/tasktree.cpp
+++ b/src/libs/solutions/tasking/tasktree.cpp
@@ -548,18 +548,6 @@ private:
*/
/*!
- \fn GroupItem Group::withTimeout(std::chrono::milliseconds timeout, const std::function<void()> &handler) const
-
- Attaches \c TimeoutTask to a copy of \c this group, elapsing after \a timeout in milliseconds,
- with an optionally provided timeout \a handler, and returns the coupled item.
-
- When the group finishes before \a timeout passes,
- the returned item finishes immediately with the group's result.
- Otherwise, the \a handler is invoked (if provided), the group's tasks are canceled,
- and the returned item finishes with an error.
-*/
-
-/*!
\class Tasking::Sync
\inheaderfile solutions/tasking/tasktree.h
\inmodule TaskingSolution
@@ -759,17 +747,6 @@ private:
*/
/*!
- \fn template <typename Adapter> GroupItem CustomTask<Adapter>::withTimeout(std::chrono::milliseconds timeout, const std::function<void()> &handler) const
-
- Attaches \c TimeoutTask to a copy of \c this task, elapsing after \a timeout in milliseconds,
- with an optionally provided timeout \a handler, and returns the coupled item.
-
- When the task finishes before \a timeout passes, the returned item finishes immediately
- with the task's result. Otherwise, \a handler is invoked (if provided),
- the task is canceled, and the returned item finishes with an error.
-*/
-
-/*!
\enum Tasking::WorkflowPolicy
This enum describes the possible behavior of the Group element when any group's child task
@@ -1415,6 +1392,26 @@ void GroupItem::addChildren(const QList<GroupItem> &children)
}
}
+/*!
+ \class Tasking::ExecutableItem
+ \inheaderfile solutions/tasking/tasktree.h
+ \inmodule TaskingSolution
+ \brief Base class for executable task items.
+ \reentrant
+
+ \c ExecutableItem provides an additional interface for items containing executable tasks.
+ Use withTimeout() to attach a timeout to a task.
+ Use withLog() to include debugging information about the task startup and the execution result.
+*/
+
+/*!
+ Attaches \c TimeoutTask to a copy of \c this ExecutableItem, elapsing after \a timeout
+ in milliseconds, with an optionally provided timeout \a handler, and returns the coupled item.
+
+ When the ExecutableItem finishes before \a timeout passes, the returned item finishes
+ immediately with the task's result. Otherwise, \a handler is invoked (if provided),
+ the task is canceled, and the returned item finishes with an error.
+*/
ExecutableItem ExecutableItem::withTimeout(milliseconds timeout,
const std::function<void()> &handler) const
{
@@ -1433,6 +1430,17 @@ ExecutableItem ExecutableItem::withTimeout(milliseconds timeout,
static QString currentTime() { return QTime::currentTime().toString(Qt::ISODateWithMs); }
+/*!
+ Attaches a custom debug printout to a copy of \c this ExecutableItem,
+ issued on task startup and after the task is finished, and returns the coupled item.
+
+ The debug printout includes a timestamp of the event (start or finish)
+ and \a logName to identify the specific task in the debug log.
+
+ The finish printout contains the additional information whether the execution was
+ synchronous or asynchronous, its result (the value described by the DoneWith enum),
+ and the total execution time in milliseconds.
+*/
ExecutableItem ExecutableItem::withLog(const QString &logName) const
{
const auto header = [logName] {
diff --git a/src/libs/solutions/terminal/terminalview.cpp b/src/libs/solutions/terminal/terminalview.cpp
index 0cebe6d9b9..472346b3fc 100644
--- a/src/libs/solutions/terminal/terminalview.cpp
+++ b/src/libs/solutions/terminal/terminalview.cpp
@@ -958,11 +958,14 @@ void TerminalView::applySizeChange()
};
if (newLiveSize.height() <= 0)
- newLiveSize.setHeight(1);
+ return;
if (newLiveSize.width() <= 0)
newLiveSize.setWidth(1);
+ if (d->m_surface->liveSize() == newLiveSize)
+ return;
+
resizePty(newLiveSize);
d->m_surface->resize(newLiveSize);
flushVTerm(true);
diff --git a/src/libs/utils/namevaluesdialog.cpp b/src/libs/utils/namevaluesdialog.cpp
index 43511fe57f..35587f8791 100644
--- a/src/libs/utils/namevaluesdialog.cpp
+++ b/src/libs/utils/namevaluesdialog.cpp
@@ -21,8 +21,7 @@ namespace Internal {
static EnvironmentItems cleanUp(const EnvironmentItems &items)
{
- EnvironmentItems uniqueItems;
- QSet<QString> uniqueSet;
+ EnvironmentItems cleanedItems;
for (int i = items.count() - 1; i >= 0; i--) {
EnvironmentItem item = items.at(i);
if (HostOsInfo::isWindowsHost())
@@ -30,10 +29,10 @@ static EnvironmentItems cleanUp(const EnvironmentItems &items)
const QString &itemName = item.name;
QString emptyName = itemName;
emptyName.remove(QLatin1Char(' '));
- if (!emptyName.isEmpty() && Utils::insert(uniqueSet, itemName))
- uniqueItems.prepend(item);
+ if (!emptyName.isEmpty())
+ cleanedItems.prepend(item);
}
- return uniqueItems;
+ return cleanedItems;
}
class TextEditHelper : public QPlainTextEdit
diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp
index 75974498d9..b399d86b36 100644
--- a/src/libs/utils/qtcprocess.cpp
+++ b/src/libs/utils/qtcprocess.cpp
@@ -1934,7 +1934,7 @@ void Process::runBlocking(seconds timeout, EventLoopMode eventLoopMode)
#endif
} else {
handleStart();
- if (!waitForFinished(timeout))
+ if (state() != QProcess::NotRunning && !waitForFinished(timeout))
handleTimeout();
}
if (blockingThresholdMs > 0) {