1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge branch 'v1.17-dev'

This commit is contained in:
Anthony Bilinski 2019-10-10 03:11:19 -07:00
commit 73fedbba79
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
10 changed files with 228 additions and 129 deletions

View File

@ -146,7 +146,7 @@ jobs:
- /opt/build-windows/x86_64 - /opt/build-windows/x86_64
- stage: "macOS, AppImage and Flatpak" - stage: "macOS, AppImage and Flatpak"
os: osx os: osx
osx_image: xcode9.2 osx_image: xcode9.3
env: JOB=build-osx env: JOB=build-osx
cache: cache:
timeout: 300 # seconds timeout: 300 # seconds

View File

@ -596,7 +596,7 @@ make install clean
## OS X ## OS X
Supported OS X versions: >=10.8. (NOTE: only 10.12 is tested during CI) Supported OS X versions: >=10.8. (NOTE: only 10.13 is tested during CI)
Compiling qTox on OS X for development requires 2 tools: Compiling qTox on OS X for development requires 2 tools:
[Xcode](https://developer.apple.com/xcode/) and [homebrew](https://brew.sh). [Xcode](https://developer.apple.com/xcode/) and [homebrew](https://brew.sh).

View File

@ -58,7 +58,9 @@ git config --global alias.logs 'log --show-signature'
merge-commit **must** be signed. To simplify the process, and ensure that merge-commit **must** be signed. To simplify the process, and ensure that
things are done "right", it's preferable to use the [`merge-pr.sh`] script, things are done "right", it's preferable to use the [`merge-pr.sh`] script,
which does that for you automatically. which does that for you automatically.
- **use** [`merge-pr.sh`] script to merge PRs, e.g. `./merge-pr.sh 1234`. - **use** [`merge-pr.sh`] script to merge PRs. First checkout the target
branch, usually either `master` or a release dev branch e.g. `v1.17-dev`,
make sure it's up to date with qTox/qTox, then e.g. `./merge-pr.sh 1234`.
You don't have to use it, but then you're running into risk of breaking You don't have to use it, but then you're running into risk of breaking
travis build of master & other PRs, since it verifies all commit messages, travis build of master & other PRs, since it verifies all commit messages,

View File

@ -5,6 +5,8 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="14" height="14"
width="14" width="14"
xml:space="preserve" xml:space="preserve"
@ -13,29 +15,35 @@
y="0px" y="0px"
x="0px" x="0px"
id="Layer_1" id="Layer_1"
version="1.1"><metadata version="1.1"
sodipodi:docname="busy_notification.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><sodipodi:namedview
pagecolor="#ff928b"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0.56470588"
inkscape:pageshadow="2"
inkscape:window-width="1850"
inkscape:window-height="1016"
id="namedview11"
showgrid="false"
inkscape:zoom="47.684444"
inkscape:cx="7.8980926"
inkscape:cy="7.6942555"
inkscape:window-x="70"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><metadata
id="metadata9"><rdf:RDF><cc:Work id="metadata9"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs7" /><g id="defs7" /><path
style="stroke-width:0.36135802;stroke-miterlimit:4;stroke-dasharray:none;stroke:#c94f50" style="fill:#c94f50;stroke-width:0.60377628"
id="layer1" d="M 7.0351562 4.1542969 C 5.327419 4.1542969 4.015625 5.4660911 4.015625 7.1738281 C 4.015625 8.8815653 5.3274191 10.191406 7.0351562 10.191406 C 8.7428933 10.191406 10.097381 8.8681685 10.054688 7.203125 C 10.054688 5.4953879 8.7428934 4.1542969 7.0351562 4.1542969 z M 4.953125 6.453125 L 9.171875 6.453125 L 9.171875 7.9882812 L 4.953125 7.9882812 L 4.953125 7.15625 L 4.953125 6.453125 z "
transform="matrix(3.0289233,0,0,3.0289233,0.18380903,-887.48895)"><path id="path3" /><path
style="fill:#000000;stroke-width:0.36135802;stroke-miterlimit:4;stroke-dasharray:none;stroke:#c94f50" style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#c94f50;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.09452569;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="" d="M 0.60742188 1.7753906 L 0.60742188 1.7773438 L 0.04296875 1.7773438 L 0.0390625 11.949219 L 13.984375 11.949219 L 13.984375 1.7753906 L 0.60742188 1.7753906 z M 1.3808594 2.8691406 L 12.644531 2.8691406 L 9.171875 6.5292969 L 9.171875 7.9882812 L 7.7871094 7.9882812 L 7.6933594 8.0878906 L 6.4296875 8.0878906 L 6.3339844 7.9882812 L 4.953125 7.9882812 L 4.953125 7.15625 L 4.953125 6.5625 L 1.3808594 2.8691406 z M 1.1367188 4.1894531 L 5.9648438 9.1835938 L 8.1640625 9.1835938 L 12.888672 4.2011719 L 12.888672 10.855469 L 1.1347656 10.855469 L 1.1367188 4.1894531 z "
id="path4500" /><path id="path4528" /></svg>
style="fill:#000000;stroke-width:0.36135802;stroke-miterlimit:4;stroke-dasharray:none;stroke:#c94f50"
d=""
id="path4498" /><path
id="path4528"
style="fill:none;stroke:#c94f50;stroke-width:0.36135802;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 0.10133195,293.90792 1.88406635,1.94794 H 2.5570778 L 4.3764717,293.9374 M 0.13990242,293.77165 H 4.375461 v 2.99779 H 0.13310726 l 9.0535e-4,-3.17789" /></g><path
d="m 10.053717,7.2034804 c 0,-1.7077371 -1.3111442,-3.0490702 -3.0188813,-3.0490702 -1.7077372,0 -3.0188815,1.3111442 -3.0188815,3.0188812 0,1.7077372 1.3111443,3.0188816 3.0188815,3.0188816 1.7077371,0 3.0615753,-1.3236491 3.0188813,-2.9886926 z M 4.9216188,6.5695153 c 0.5055481,0 4.2264342,0 4.2264342,0 0,0.3576655 0,0.7183127 0,1.2075524 -0.5600147,0 -3.5305832,0 -4.2264342,0 0,-0.3231018 -2.1e-6,-0.720037 0,-1.2075524 z"
id="path3"
style="fill:#c94f50;stroke-width:0.60377628" /><rect
y="7.1552882"
x="5.6552882"
height="0.13001703"
width="2.8144238"
id="rect821"
style="opacity:1;fill:#ff00ff;fill-opacity:1;stroke:#ffffff;stroke-width:1.4043262;stroke-miterlimit:4;stroke-dasharray:none" /></svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -52,6 +52,9 @@ source_functions() {
main() { main() {
local remote_name="upstream" local remote_name="upstream"
local merge_branch="merge" local merge_branch="merge"
local base_branch # because assigning on the same line will break error code parsing.. http://www.tldp.org/LDP/abs/html/localvar.html
base_branch=$(git symbolic-ref HEAD --short)
source_functions source_functions
exit_if_not_pr $PR exit_if_not_pr $PR
add_remote add_remote

View File

@ -92,6 +92,26 @@ install() {
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n' read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'
fi fi
# osx 10.13 High Sierra doesn't come with a /usr/local/sbin, yet it is needed by some brew packages
NEEDED_DEP_DIR="/usr/local/sbin"
if [[ $TRAVIS = true ]]
then
sudo mkdir -p $NEEDED_DEP_DIR
sudo chown -R $(whoami) $NEEDED_DEP_DIR
elif [[ ! -d $NEEDED_DEP_DIR ]]
then
fcho "The direcory $NEEDED_DEP_DIR must exist for some development packages."
read -r -p "Would you like to create it now, and set the owner to $(whoami)? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
sudo mkdir $NEEDED_DEP_DIR
sudo chown -R $(whoami) $NEEDED_DEP_DIR
else
fcho "Cannot proceed without $NEEDED_DEP_DIR. Exiting."
exit 0
fi
fi
#fcho "Installing x-code Command line tools ..." #fcho "Installing x-code Command line tools ..."
#xcode-select --install #xcode-select --install
@ -170,9 +190,23 @@ install() {
# needed for kf5-sonnet # needed for kf5-sonnet
brew tap kde-mac/kde brew tap kde-mac/kde
# verbose so that build output is shown, otherwise qt5 build has no output for >10 mins # brew install qt5 might take a long time to build Qt. Travis kills us if
# and is killed by Travis CI # we don't output for 10 minutes. Travis also kills us if we output too much,
brew install --verbose ffmpeg libexif qrencode qt5 sqlcipher openal-soft #kf5-sonnet # so verbose isn't an option. So just output some dots...
if [[ $TRAVIS = true ]]
then
echo "outputting dots to keep travis from killing us..."
while true; do
echo -n "."
sleep 10
done &
DOT_PID=$!
fi
brew install ffmpeg libexif qrencode qt5 sqlcipher openal-soft #kf5-sonnet
if [[ $TRAVIS = true ]]
then
kill $DOT_PID
fi
fcho "Cloning filter_audio ... " fcho "Cloning filter_audio ... "
git clone --branch v0.0.1 --depth=1 https://github.com/irungentoo/filter_audio "$FILTERAUIO_DIR" git clone --branch v0.0.1 --depth=1 https://github.com/irungentoo/filter_audio "$FILTERAUIO_DIR"

View File

@ -142,7 +142,7 @@ ChatLog::~ChatLog()
void ChatLog::clearSelection() void ChatLog::clearSelection()
{ {
if (selectionMode == None) if (selectionMode == SelectionMode::None)
return; return;
for (int i = selFirstRow; i <= selLastRow; ++i) for (int i = selFirstRow; i <= selLastRow; ++i)
@ -153,7 +153,7 @@ void ChatLog::clearSelection()
selClickedCol = -1; selClickedCol = -1;
selClickedRow = -1; selClickedRow = -1;
selectionMode = None; selectionMode = SelectionMode::None;
emit selectionChanged(); emit selectionChanged();
updateMultiSelectionRect(); updateMultiSelectionRect();
@ -220,7 +220,7 @@ void ChatLog::mouseReleaseEvent(QMouseEvent* ev)
{ {
QGraphicsView::mouseReleaseEvent(ev); QGraphicsView::mouseReleaseEvent(ev);
selectionScrollDir = NoDirection; selectionScrollDir = AutoScrollDirection::NoDirection;
multiClickTimer->start(); multiClickTimer->start();
} }
@ -234,14 +234,14 @@ void ChatLog::mouseMoveEvent(QMouseEvent* ev)
if (ev->buttons() & Qt::LeftButton) { if (ev->buttons() & Qt::LeftButton) {
// autoscroll // autoscroll
if (ev->pos().y() < 0) if (ev->pos().y() < 0)
selectionScrollDir = Up; selectionScrollDir = AutoScrollDirection::Up;
else if (ev->pos().y() > height()) else if (ev->pos().y() > height())
selectionScrollDir = Down; selectionScrollDir = AutoScrollDirection::Down;
else else
selectionScrollDir = NoDirection; selectionScrollDir = AutoScrollDirection::NoDirection;
// select // select
if (selectionMode == None if (selectionMode == SelectionMode::None
&& (clickPos - ev->pos()).manhattanLength() > QApplication::startDragDistance()) { && (clickPos - ev->pos()).manhattanLength() > QApplication::startDragDistance()) {
QPointF sceneClickPos = mapToScene(clickPos.toPoint()); QPointF sceneClickPos = mapToScene(clickPos.toPoint());
ChatLine::Ptr line = findLineByPosY(scenePos.y()); ChatLine::Ptr line = findLineByPosY(scenePos.y());
@ -255,7 +255,7 @@ void ChatLog::mouseMoveEvent(QMouseEvent* ev)
content->selectionStarted(sceneClickPos); content->selectionStarted(sceneClickPos);
selectionMode = Precise; selectionMode = SelectionMode::Precise;
// ungrab mouse grabber // ungrab mouse grabber
if (scene->mouseGrabberItem()) if (scene->mouseGrabberItem())
@ -265,11 +265,11 @@ void ChatLog::mouseMoveEvent(QMouseEvent* ev)
selFirstRow = selClickedRow; selFirstRow = selClickedRow;
selLastRow = selClickedRow; selLastRow = selClickedRow;
selectionMode = Multi; selectionMode = SelectionMode::Multi;
} }
} }
if (selectionMode != None) { if (selectionMode != SelectionMode::None) {
ChatLineContent* content = getContentFromPos(scenePos); ChatLineContent* content = getContentFromPos(scenePos);
ChatLine::Ptr line = findLineByPosY(scenePos.y()); ChatLine::Ptr line = findLineByPosY(scenePos.y());
@ -280,12 +280,12 @@ void ChatLog::mouseMoveEvent(QMouseEvent* ev)
int col = content->getColumn(); int col = content->getColumn();
if (row == selClickedRow && col == selClickedCol) { if (row == selClickedRow && col == selClickedCol) {
selectionMode = Precise; selectionMode = SelectionMode::Precise;
content->selectionMouseMove(scenePos); content->selectionMouseMove(scenePos);
selGraphItem->hide(); selGraphItem->hide();
} else if (col != selClickedCol) { } else if (col != selClickedCol) {
selectionMode = Multi; selectionMode = SelectionMode::Multi;
lines[selClickedRow]->selectionCleared(); lines[selClickedRow]->selectionCleared();
} }
@ -293,7 +293,7 @@ void ChatLog::mouseMoveEvent(QMouseEvent* ev)
row = line->getRow(); row = line->getRow();
if (row != selClickedRow) { if (row != selClickedRow) {
selectionMode = Multi; selectionMode = SelectionMode::Multi;
lines[selClickedRow]->selectionCleared(); lines[selClickedRow]->selectionCleared();
} }
} else { } else {
@ -332,12 +332,12 @@ ChatLineContent* ChatLog::getContentFromPos(QPointF scenePos) const
bool ChatLog::isOverSelection(QPointF scenePos) const bool ChatLog::isOverSelection(QPointF scenePos) const
{ {
if (selectionMode == Precise) { if (selectionMode == SelectionMode::Precise) {
ChatLineContent* content = getContentFromPos(scenePos); ChatLineContent* content = getContentFromPos(scenePos);
if (content) if (content)
return content->isOverSelection(scenePos); return content->isOverSelection(scenePos);
} else if (selectionMode == Multi) { } else if (selectionMode == SelectionMode::Multi) {
if (selGraphItem->rect().contains(scenePos)) if (selGraphItem->rect().contains(scenePos))
return true; return true;
} }
@ -457,7 +457,7 @@ void ChatLog::insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines)
lines = combLines; lines = combLines;
moveSelectionRectDownIfMulti(newLines.size()); moveSelectionRectDownIfSelected(newLines.size());
scene->setItemIndexMethod(oldIndexMeth); scene->setItemIndexMethod(oldIndexMeth);
@ -528,7 +528,7 @@ void ChatLog::mouseDoubleClickEvent(QMouseEvent* ev)
selClickedRow = content->getRow(); selClickedRow = content->getRow();
selFirstRow = content->getRow(); selFirstRow = content->getRow();
selLastRow = content->getRow(); selLastRow = content->getRow();
selectionMode = Precise; selectionMode = SelectionMode::Precise;
emit selectionChanged(); emit selectionChanged();
} }
@ -549,9 +549,9 @@ void ChatLog::mouseDoubleClickEvent(QMouseEvent* ev)
QString ChatLog::getSelectedText() const QString ChatLog::getSelectedText() const
{ {
if (selectionMode == Precise) { if (selectionMode == SelectionMode::Precise) {
return lines[selClickedRow]->content[selClickedCol]->getSelectedText(); return lines[selClickedRow]->content[selClickedCol]->getSelectedText();
} else if (selectionMode == Multi) { } else if (selectionMode == SelectionMode::Multi) {
// build a nicely formatted message // build a nicely formatted message
QString out; QString out;
@ -582,7 +582,7 @@ bool ChatLog::isEmpty() const
bool ChatLog::hasTextToBeCopied() const bool ChatLog::hasTextToBeCopied() const
{ {
return selectionMode != None; return selectionMode != SelectionMode::None;
} }
ChatLine::Ptr ChatLog::getTypingNotification() const ChatLine::Ptr ChatLog::getTypingNotification() const
@ -700,7 +700,7 @@ void ChatLog::selectAll()
clearSelection(); clearSelection();
selectionMode = Multi; selectionMode = SelectionMode::Multi;
selFirstRow = 0; selFirstRow = 0;
selLastRow = lines.size() - 1; selLastRow = lines.size() - 1;
@ -727,51 +727,6 @@ void ChatLog::reloadTheme()
} }
} }
/**
* @brief Adjusts the multi line selection rectangle based on chatlog changing lines
* @param offset Amount to shift selection rect up by. Must be non-negative.
*/
void ChatLog::moveSelectionRectUpIfMulti(int offset)
{
assert(offset >= 0);
if (selectionMode != Multi) {
return;
}
if (selLastRow < offset) { // entire selection now out of bounds
clearSelection();
return;
} else {
selLastRow -= offset;
}
selClickedRow = std::max(0, selClickedRow - offset);
selFirstRow = std::max(0, selFirstRow - offset);
updateMultiSelectionRect();
emit selectionChanged();
}
/**
* @brief Adjusts the multi line selection rectangle based on chatlog changing lines
* @param offset Amount to shift selection rect down by. Must be non-negative.
*/
void ChatLog::moveSelectionRectDownIfMulti(int offset)
{
assert(offset >= 0);
if (selectionMode != Multi) {
return;
}
const int lastLine = lines.size() - 1;
if (selFirstRow + offset > lastLine) { // entire selection now out of bounds
clearSelection();
return;
} else {
selFirstRow += offset;
}
selClickedRow = std::min(lastLine, selClickedRow + offset);
selLastRow = std::min(lastLine, selLastRow + offset);
updateMultiSelectionRect();
emit selectionChanged();
}
void ChatLog::removeFirsts(const int num) void ChatLog::removeFirsts(const int num)
{ {
if (lines.size() > num) { if (lines.size() > num) {
@ -785,7 +740,7 @@ void ChatLog::removeFirsts(const int num)
lines[i]->setRow(i); lines[i]->setRow(i);
} }
moveSelectionRectUpIfMulti(num); moveSelectionRectUpIfSelected(num);
} }
void ChatLog::removeLasts(const int num) void ChatLog::removeLasts(const int num)
@ -889,7 +844,7 @@ void ChatLog::resizeEvent(QResizeEvent* ev)
void ChatLog::updateMultiSelectionRect() void ChatLog::updateMultiSelectionRect()
{ {
if (selectionMode == Multi && selFirstRow >= 0 && selLastRow >= 0) { if (selectionMode == SelectionMode::Multi && selFirstRow >= 0 && selLastRow >= 0) {
QRectF selBBox; QRectF selBBox;
selBBox = selBBox.united(lines[selFirstRow]->sceneBoundingRect()); selBBox = selBBox.united(lines[selFirstRow]->sceneBoundingRect());
selBBox = selBBox.united(lines[selLastRow]->sceneBoundingRect()); selBBox = selBBox.united(lines[selLastRow]->sceneBoundingRect());
@ -954,10 +909,10 @@ void ChatLog::onSelectionTimerTimeout()
const int scrollSpeed = 10; const int scrollSpeed = 10;
switch (selectionScrollDir) { switch (selectionScrollDir) {
case Up: case AutoScrollDirection::Up:
verticalScrollBar()->setValue(verticalScrollBar()->value() - scrollSpeed); verticalScrollBar()->setValue(verticalScrollBar()->value() - scrollSpeed);
break; break;
case Down: case AutoScrollDirection::Down:
verticalScrollBar()->setValue(verticalScrollBar()->value() + scrollSpeed); verticalScrollBar()->setValue(verticalScrollBar()->value() + scrollSpeed);
break; break;
default: default:
@ -1028,7 +983,7 @@ void ChatLog::handleMultiClickEvent()
selClickedRow = content->getRow(); selClickedRow = content->getRow();
selFirstRow = content->getRow(); selFirstRow = content->getRow();
selLastRow = content->getRow(); selLastRow = content->getRow();
selectionMode = Precise; selectionMode = SelectionMode::Precise;
emit selectionChanged(); emit selectionChanged();
} }
@ -1047,7 +1002,7 @@ void ChatLog::focusInEvent(QFocusEvent* ev)
{ {
QGraphicsView::focusInEvent(ev); QGraphicsView::focusInEvent(ev);
if (selectionMode != None) { if (selectionMode != SelectionMode::None) {
selGraphItem->setBrush(QBrush(selectionRectColor)); selGraphItem->setBrush(QBrush(selectionRectColor));
for (int i = selFirstRow; i <= selLastRow; ++i) for (int i = selFirstRow; i <= selLastRow; ++i)
@ -1059,7 +1014,7 @@ void ChatLog::focusOutEvent(QFocusEvent* ev)
{ {
QGraphicsView::focusOutEvent(ev); QGraphicsView::focusOutEvent(ev);
if (selectionMode != None) { if (selectionMode != SelectionMode::None) {
selGraphItem->setBrush(QBrush(selectionRectColor.lighter(120))); selGraphItem->setBrush(QBrush(selectionRectColor.lighter(120)));
for (int i = selFirstRow; i <= selLastRow; ++i) for (int i = selFirstRow; i <= selLastRow; ++i)
@ -1100,3 +1055,99 @@ bool ChatLog::isActiveFileTransfer(ChatLine::Ptr l)
return false; return false;
} }
/**
* @brief Adjusts the selection based on chatlog changing lines
* @param offset Amount to shift selection rect up by. Must be non-negative.
*/
void ChatLog::moveSelectionRectUpIfSelected(int offset)
{
assert(offset >= 0);
switch (selectionMode)
{
case SelectionMode::None:
return;
case SelectionMode::Precise:
movePreciseSelectionUp(offset);
break;
case SelectionMode::Multi:
moveMultiSelectionUp(offset);
break;
}
}
/**
* @brief Adjusts the selections based on chatlog changing lines
* @param offset removed from the lines indexes. Must be non-negative.
*/
void ChatLog::moveSelectionRectDownIfSelected(int offset)
{
assert(offset >= 0);
switch (selectionMode)
{
case SelectionMode::None:
return;
case SelectionMode::Precise:
movePreciseSelectionDown(offset);
break;
case SelectionMode::Multi:
moveMultiSelectionDown(offset);
break;
}
}
void ChatLog::movePreciseSelectionDown(int offset)
{
assert(selFirstRow == selLastRow && selFirstRow == selClickedRow);
const int lastLine = lines.size() - 1;
if (selClickedRow + offset > lastLine) {
clearSelection();
} else {
const int newRow = selClickedRow + offset;
selClickedRow = newRow;
selLastRow = newRow;
selFirstRow = newRow;
emit selectionChanged();
}
}
void ChatLog::movePreciseSelectionUp(int offset)
{
assert(selFirstRow == selLastRow && selFirstRow == selClickedRow);
if (selClickedRow < offset) {
clearSelection();
} else {
const int newRow = selClickedRow - offset;
selClickedRow = newRow;
selLastRow = newRow;
selFirstRow = newRow;
emit selectionChanged();
}
}
void ChatLog::moveMultiSelectionUp(int offset)
{
if (selLastRow < offset) { // entire selection now out of bounds
clearSelection();
} else {
selLastRow -= offset;
selClickedRow = std::max(0, selClickedRow - offset);
selFirstRow = std::max(0, selFirstRow - offset);
updateMultiSelectionRect();
emit selectionChanged();
}
}
void ChatLog::moveMultiSelectionDown(int offset)
{
const int lastLine = lines.size() - 1;
if (selFirstRow + offset > lastLine) { // entire selection now out of bounds
clearSelection();
} else {
selFirstRow += offset;
selClickedRow = std::min(lastLine, selClickedRow + offset);
selLastRow = std::min(lastLine, selLastRow + offset);
updateMultiSelectionRect();
emit selectionChanged();
}
}

View File

@ -58,8 +58,6 @@ public:
void selectAll(); void selectAll();
void fontChanged(const QFont& font); void fontChanged(const QFont& font);
void reloadTheme(); void reloadTheme();
void moveSelectionRectUpIfMulti(int offset);
void moveSelectionRectDownIfMulti(int offset);
void removeFirsts(const int num); void removeFirsts(const int num);
void removeLasts(const int num); void removeLasts(const int num);
void setScroll(const bool scroll); void setScroll(const bool scroll);
@ -130,16 +128,22 @@ private:
void retranslateUi(); void retranslateUi();
bool isActiveFileTransfer(ChatLine::Ptr l); bool isActiveFileTransfer(ChatLine::Ptr l);
void handleMultiClickEvent(); void handleMultiClickEvent();
void moveSelectionRectUpIfSelected(int offset);
void moveSelectionRectDownIfSelected(int offset);
void movePreciseSelectionDown(int offset);
void movePreciseSelectionUp(int offset);
void moveMultiSelectionUp(int offset);
void moveMultiSelectionDown(int offset);
private: private:
enum SelectionMode enum class SelectionMode
{ {
None, None,
Precise, Precise,
Multi, Multi,
}; };
enum AutoScrollDirection enum class AutoScrollDirection
{ {
NoDirection, NoDirection,
Up, Up,
@ -161,13 +165,13 @@ private:
int selFirstRow = -1; int selFirstRow = -1;
int selLastRow = -1; int selLastRow = -1;
QColor selectionRectColor = Style::getColor(Style::SelectText); QColor selectionRectColor = Style::getColor(Style::SelectText);
SelectionMode selectionMode = None; SelectionMode selectionMode = SelectionMode::None;
QPointF clickPos; QPointF clickPos;
QGraphicsRectItem* selGraphItem = nullptr; QGraphicsRectItem* selGraphItem = nullptr;
QTimer* selectionTimer = nullptr; QTimer* selectionTimer = nullptr;
QTimer* workerTimer = nullptr; QTimer* workerTimer = nullptr;
QTimer* multiClickTimer = nullptr; QTimer* multiClickTimer = nullptr;
AutoScrollDirection selectionScrollDir = NoDirection; AutoScrollDirection selectionScrollDir = AutoScrollDirection::NoDirection;
int clickCount = 0; int clickCount = 0;
QPoint lastClickPos; QPoint lastClickPos;
Qt::MouseButton lastClickButton; Qt::MouseButton lastClickButton;

View File

@ -797,24 +797,19 @@ void Core::bootstrapDht()
QString dhtServerAddress = dhtServer.address.toLatin1(); QString dhtServerAddress = dhtServer.address.toLatin1();
QString port = QString::number(dhtServer.port); QString port = QString::number(dhtServer.port);
QString name = dhtServer.name; QString name = dhtServer.name;
qDebug() << QString("Connecting to %1:%2 (%3)").arg(dhtServerAddress, port, name); qDebug() << QString("Connecting to a bootstrap node...");
QByteArray address = dhtServer.address.toLatin1(); QByteArray address = dhtServer.address.toLatin1();
// TODO: constucting the pk via ToxId is a workaround // TODO: constucting the pk via ToxId is a workaround
ToxPk pk = ToxId{dhtServer.userId}.getPublicKey(); ToxPk pk = ToxId{dhtServer.userId}.getPublicKey();
const uint8_t* pkPtr = pk.getData(); const uint8_t* pkPtr = pk.getData();
Tox_Err_Bootstrap error; Tox_Err_Bootstrap error;
tox_bootstrap(tox.get(), address.constData(), dhtServer.port, pkPtr, &error); tox_bootstrap(tox.get(), address.constData(), dhtServer.port, pkPtr, &error);
if (!PARSE_ERR(error)) { PARSE_ERR(error);
qDebug() << "Error bootstrapping from " + dhtServer.name;
}
tox_add_tcp_relay(tox.get(), address.constData(), dhtServer.port, pkPtr, &error); tox_add_tcp_relay(tox.get(), address.constData(), dhtServer.port, pkPtr, &error);
if (!PARSE_ERR(error)) { PARSE_ERR(error);
qDebug() << "Error adding TCP relay from " + dhtServer.name;
}
++j; ++j;
++i; ++i;
@ -1451,6 +1446,11 @@ QString Core::getGroupPeerName(int groupId, int peerId) const
{ {
QMutexLocker ml{&coreLoopLock}; QMutexLocker ml{&coreLoopLock};
// from tox.h: "If peer_number == UINT32_MAX, then author is unknown (e.g. initial joining the conference)."
if (peerId != std::numeric_limits<uint32_t>::max()) {
return {};
}
Tox_Err_Conference_Peer_Query error; Tox_Err_Conference_Peer_Query error;
size_t length = tox_conference_peer_get_name_size(tox.get(), groupId, peerId, &error); size_t length = tox_conference_peer_get_name_size(tox.get(), groupId, peerId, &error);
if (!PARSE_ERR(error) || !length) { if (!PARSE_ERR(error) || !length) {

View File

@ -60,24 +60,24 @@ add_remote() {
after_merge_msg() { after_merge_msg() {
echo "" echo ""
echo "PR #$PR was merged into «$@$PR» branch." echo "PR #$PR was merged into «$@$PR» branch."
echo "To compare with master:" echo "To compare with $base_branch:"
echo "" echo ""
echo " git diff master..$@$PR" echo " git diff $base_branch..$@$PR"
echo "" echo ""
if [[ "$@" == "merge" ]] if [[ "$@" == "merge" ]]
then then
echo "To push that to master on github:" echo "To push that to $base_branch on github:"
echo "" echo ""
echo " git checkout master && git merge --ff $@$PR && git push upstream master" echo " git checkout $base_branch && git merge --ff $@$PR && git push upstream $base_branch"
echo "" echo ""
echo "After pushing to master, delete branches:" echo "After pushing to $base_branch, delete branches:"
echo "" echo ""
echo " git branch -d {$@,}$PR" echo " git branch -d {$@,}$PR"
echo "" echo ""
fi fi
echo "To discard any changes:" echo "To discard any changes:"
echo "" echo ""
echo " git checkout master && git branch -D {$@,}$PR" echo " git checkout $base_branch && git branch -D {$@,}$PR"
echo "" echo ""
} }
@ -88,7 +88,7 @@ after_merge_failure_msg() {
echo "" echo ""
echo "You may want to remove not merged branches, if they exist:" echo "You may want to remove not merged branches, if they exist:"
echo "" echo ""
echo " git checkout master && git branch -D {$@,}$PR" echo " git checkout $base_branch && git branch -D {$@,}$PR"
echo "" echo ""
} }
@ -100,16 +100,13 @@ rm_obsolete_branch() {
get_sources() { get_sources() {
add_remote add_remote
rm_obsolete_branch rm_obsolete_branch
git fetch $remote_name && \
git checkout master && \
git rebase $remote_name/master master && \
git fetch $remote_name pull/$PR/head:$PR && \ git fetch $remote_name pull/$PR/head:$PR && \
git checkout master -b $merge_branch$PR git checkout $base_branch -b $merge_branch$PR
} }
# check whether to sign # check whether to sign
merge() { merge() {
"${@}" --no-ff $PR -m "Merge pull request #$PR "${@}" --no-ff $PR -m "Merge pull request #$PR
$OPT_MSG $OPT_MSG
$(git shortlog master..$PR)" $(git shortlog $base_branch..$PR)"
} }