Skip to content

Commit

Permalink
Improve file browser further
Browse files Browse the repository at this point in the history
* Use push buttons in tool bar because they have better behavior when using
  menus in case the button itself is not supposed to do anything but show
  the menu
    * Note that using QToolButton with QToolButton::InstantPopup gives the
      correct behavior but no arrow is shown
* Improve text used on primary button
* Use clear method instead of loop
* Avoid floating/moving behavior of toolbar as there is no other place to
  put it anyway
* Prevent review action from disappearing (due to reparenting)
* Show confirmation dialog when triggering review action a second time from
  toolbar
* Update translations
  • Loading branch information
Martchus committed Jan 31, 2025
1 parent 3290ac1 commit ad604f1
Show file tree
Hide file tree
Showing 10 changed files with 306 additions and 175 deletions.
6 changes: 3 additions & 3 deletions syncthingmodel/syncthingfilemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ QList<QAction *> SyncthingFileModel::selectionActions()
if (!m_selectionMode) {
auto *const startSelectionAction = new QAction(tr("Select items to sync/ignore"), this);
startSelectionAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-select")));
startSelectionAction->setData(QStringLiteral("primary"));
startSelectionAction->setData(QStringLiteral("primary:") + tr("Select"));
connect(startSelectionAction, &QAction::triggered, this, [this] { setSelectionModeEnabled(true); });
res << startSelectionAction;

Expand All @@ -790,7 +790,7 @@ QList<QAction *> SyncthingFileModel::selectionActions()
} else {
auto *const discardAction = new QAction(tr("Uncheck all and discard staged changes"), this);
discardAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
discardAction->setData(QStringLiteral("primary"));
discardAction->setData(QStringLiteral("primary:") + tr("Discard"));
connect(discardAction, &QAction::triggered, this, [this] {
if (const auto rootIndex = index(0, 0); rootIndex.isValid()) {
setCheckState(index(0, 0), Qt::Unchecked, true);
Expand Down Expand Up @@ -885,7 +885,7 @@ QList<QAction *> SyncthingFileModel::selectionActions()
if (!m_stagedChanges.isEmpty() || !m_stagedLocalFileDeletions.isEmpty()) {
auto *const applyStagedChangesAction = new RejectableAction(tr("Review and apply staged changes"), this);
applyStagedChangesAction->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok-apply")));
applyStagedChangesAction->setData(QStringLiteral("primary"));
applyStagedChangesAction->setData(QStringLiteral("primary:") + tr("Apply"));
connect(applyStagedChangesAction, &QAction::triggered, this, [this, action = applyStagedChangesAction]() mutable {
// allow user to review changes before applying them
if (action->needsConfirmation) {
Expand Down
43 changes: 29 additions & 14 deletions syncthingmodel/translations/syncthingmodel_cs_CZ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,79 +493,94 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="780"/>
<location filename="../syncthingfilemodel.cpp" line="776"/>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="781"/>
<source>Discard staged changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="790"/>
<location filename="../syncthingfilemodel.cpp" line="791"/>
<source>Uncheck all and discard staged changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="803"/>
<location filename="../syncthingfilemodel.cpp" line="793"/>
<source>Discard</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="805"/>
<source>Ignore checked items (and their children)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="815"/>
<location filename="../syncthingfilemodel.cpp" line="819"/>
<source>Include checked items (and their children)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="852"/>
<location filename="../syncthingfilemodel.cpp" line="858"/>
<source>Remove ignore patterns matching checked items (may affect other items as well)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="822"/>
<location filename="../syncthingfilemodel.cpp" line="827"/>
<source>Include all items by default</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="809"/>
<location filename="../syncthingfilemodel.cpp" line="812"/>
<source>Ignore and locally delete checked items (and their children)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="822"/>
<location filename="../syncthingfilemodel.cpp" line="827"/>
<source>Ignore all items by default</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="880"/>
<location filename="../syncthingfilemodel.cpp" line="886"/>
<source>Review and apply staged changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="888"/>
<source>Apply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="895"/>
<source>Do you want to apply the following changes?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="896"/>
<location filename="../syncthingfilemodel.cpp" line="903"/>
<source>Cannot apply ignore patterns while a previous request for ignore patterns is still pending.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="904"/>
<location filename="../syncthingfilemodel.cpp" line="911"/>
<source>Unable to change ignore patterns:
%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="930"/>
<location filename="../syncthingfilemodel.cpp" line="937"/>
<source>Ignore patterns have been changed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="932"/>
<location filename="../syncthingfilemodel.cpp" line="939"/>
<source>Ignore patterns have been changed but the following local files could not be deleted:
</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="1108"/>
<location filename="../syncthingfilemodel.cpp" line="1115"/>
<source>Cannot query ignore patterns while a previous request for ignore patterns is still pending.</source>
<translation type="unfinished"></translation>
</message>
Expand Down
56 changes: 36 additions & 20 deletions syncthingmodel/translations/syncthingmodel_de_DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,34 +571,44 @@
<translation>Elemente zum Synchronisieren/Ignorieren auswählen</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="780"/>
<location filename="../syncthingfilemodel.cpp" line="776"/>
<source>Select</source>
<translation>Auswahl</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="781"/>
<source>Discard staged changes</source>
<translation>Vorgemerkte Änderungen verwerfen</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="790"/>
<location filename="../syncthingfilemodel.cpp" line="791"/>
<source>Uncheck all and discard staged changes</source>
<translation type="unfinished"></translation>
<translation>Vorgemerkte Änderungen und Auswahl verwerfen</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="793"/>
<source>Discard</source>
<translation>Verwerfen</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="803"/>
<location filename="../syncthingfilemodel.cpp" line="805"/>
<source>Ignore checked items (and their children)</source>
<translation type="unfinished"></translation>
<translation>Ausgewählte Elemente ignorieren (einschließlich untergeordneter Elemente)</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="809"/>
<location filename="../syncthingfilemodel.cpp" line="812"/>
<source>Ignore and locally delete checked items (and their children)</source>
<translation type="unfinished"></translation>
<translation>Ausgewählte Elemente ignorieren und lokal löschen (einschließlich untergeordneter Elemente)</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="815"/>
<location filename="../syncthingfilemodel.cpp" line="819"/>
<source>Include checked items (and their children)</source>
<translation type="unfinished"></translation>
<translation>Ausgewählte Elemente synchronisieren (einschließlich untergeordneter Elemente)</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="852"/>
<location filename="../syncthingfilemodel.cpp" line="858"/>
<source>Remove ignore patterns matching checked items (may affect other items as well)</source>
<translation type="unfinished"></translation>
<translation>Lösche Ignoriermuster die mit ausgewählten Elementen übereinstimmen (kann auch andere Elemente betreffen)</translation>
</message>
<message>
<source>Discard selection and staged changes</source>
Expand All @@ -613,12 +623,12 @@
<translation type="vanished">Ausgewählte Elemente synchronisieren (und untergeordnete Elemente)</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="822"/>
<location filename="../syncthingfilemodel.cpp" line="827"/>
<source>Include all items by default</source>
<translation>Alle Elemente standardmäßig synchronisieren</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="822"/>
<location filename="../syncthingfilemodel.cpp" line="827"/>
<source>Ignore all items by default</source>
<translation>Alle Elemente standardmäßig ignorieren</translation>
</message>
Expand All @@ -627,40 +637,46 @@
<translation type="vanished">Lösche Ignoriermuster die mit ausgewählten Elementen übereinstimmen (kann auch andere Elemente betreffen)</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="880"/>
<location filename="../syncthingfilemodel.cpp" line="886"/>
<source>Review and apply staged changes</source>
<translation>Vorgemerkte Änderungen überprüfen und anwenden</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="888"/>
<source>Apply</source>
<translation>Anwenden</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="895"/>
<source>Do you want to apply the following changes?</source>
<translation>Sollen die folgenden Änderungen angewandt werden?</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="896"/>
<location filename="../syncthingfilemodel.cpp" line="903"/>
<source>Cannot apply ignore patterns while a previous request for ignore patterns is still pending.</source>
<translation>Ignoriermuster können nicht gespeichert werden, da noch eine vorherige Abfrage in Gange ist.</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="904"/>
<location filename="../syncthingfilemodel.cpp" line="911"/>
<source>Unable to change ignore patterns:
%1</source>
<translation>Kann Ignoriermuster nicht speichern:
%1</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="930"/>
<location filename="../syncthingfilemodel.cpp" line="937"/>
<source>Ignore patterns have been changed.</source>
<translation>Ignoriermuster wurden gespeichert.</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="932"/>
<location filename="../syncthingfilemodel.cpp" line="939"/>
<source>Ignore patterns have been changed but the following local files could not be deleted:
</source>
<translation type="unfinished"></translation>
<translation>Ignoriermuster wurden gespeichert, aber die folgenden lokalen Dateien konnten nicht gelöscht werden:
</translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="1108"/>
<location filename="../syncthingfilemodel.cpp" line="1115"/>
<source>Cannot query ignore patterns while a previous request for ignore patterns is still pending.</source>
<translation>Ignoriermuster können nicht abgefragt werden, da noch eine vorherige Abfrage in Gange ist.</translation>
</message>
Expand Down
43 changes: 29 additions & 14 deletions syncthingmodel/translations/syncthingmodel_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,79 +411,94 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="780"/>
<location filename="../syncthingfilemodel.cpp" line="776"/>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="781"/>
<source>Discard staged changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="790"/>
<location filename="../syncthingfilemodel.cpp" line="791"/>
<source>Uncheck all and discard staged changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="803"/>
<location filename="../syncthingfilemodel.cpp" line="793"/>
<source>Discard</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="805"/>
<source>Ignore checked items (and their children)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="815"/>
<location filename="../syncthingfilemodel.cpp" line="819"/>
<source>Include checked items (and their children)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="852"/>
<location filename="../syncthingfilemodel.cpp" line="858"/>
<source>Remove ignore patterns matching checked items (may affect other items as well)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="822"/>
<location filename="../syncthingfilemodel.cpp" line="827"/>
<source>Include all items by default</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="809"/>
<location filename="../syncthingfilemodel.cpp" line="812"/>
<source>Ignore and locally delete checked items (and their children)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="822"/>
<location filename="../syncthingfilemodel.cpp" line="827"/>
<source>Ignore all items by default</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="880"/>
<location filename="../syncthingfilemodel.cpp" line="886"/>
<source>Review and apply staged changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="888"/>
<source>Apply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="895"/>
<source>Do you want to apply the following changes?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="896"/>
<location filename="../syncthingfilemodel.cpp" line="903"/>
<source>Cannot apply ignore patterns while a previous request for ignore patterns is still pending.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="904"/>
<location filename="../syncthingfilemodel.cpp" line="911"/>
<source>Unable to change ignore patterns:
%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="930"/>
<location filename="../syncthingfilemodel.cpp" line="937"/>
<source>Ignore patterns have been changed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="932"/>
<location filename="../syncthingfilemodel.cpp" line="939"/>
<source>Ignore patterns have been changed but the following local files could not be deleted:
</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../syncthingfilemodel.cpp" line="1108"/>
<location filename="../syncthingfilemodel.cpp" line="1115"/>
<source>Cannot query ignore patterns while a previous request for ignore patterns is still pending.</source>
<translation type="unfinished"></translation>
</message>
Expand Down
Loading

0 comments on commit ad604f1

Please sign in to comment.