Changeset 2b01ab7 in subsurface


Ignore:
Timestamp:
Jun 18, 2017, 1:00:30 AM (3 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
6afe6ba
Parents:
4866dd6
git-author:
Dirk Hohndel <dirk@…> (06/17/17 23:50:22)
git-committer:
Dirk Hohndel <dirk@…> (06/18/17 01:00:30)
Message:

Clean up git storage update messages

Translate all of them, but also remove some redundant or possibly
misleading messages. These are now seen by users, not just developers
trying to debug the code.

Signed-off-by: Dirk Hohndel <dirk@…>

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • core/checkcloudconnection.cpp

    rb2b51c8 r2b01ab7  
    5353                                if (verbose > 1)
    5454                                        qWarning() << "Cloud storage: successfully checked connection to cloud server";
    55                                 git_storage_update_progress("successfully checked cloud connection");
    5655                                return true;
    5756                        }
    5857                } else if (seconds < prefs.cloud_timeout) {
    59                         QString text = QString("waited %1 sec for cloud connetion").arg(seconds);
     58                        QString text = tr("Waiting for cloud connetion (%1 seconds passed)").arg(seconds);
    6059                        git_storage_update_progress(qPrintable(text));
    6160                } else {
     
    6463                }
    6564        }
    66         git_storage_update_progress("cloud connection failed");
     65        git_storage_update_progress(qPrintable(tr("Cloud connection failed")));
    6766        prefs.git_local_only = true;
    6867        if (verbose)
  • core/git-access.c

    rb2b51c8 r2b01ab7  
    9898        char buf[80];
    9999        snprintf(buf, sizeof(buf), translate("gettextFromC", "Transfer to storage (%d/%d)"), current, total);
    100         return git_storage_update_progress("push trasfer cb");
     100        return git_storage_update_progress(buf);
    101101}
    102102
     
    433433        if (verbose)
    434434                fprintf(stderr, "git storage: try to update\n");
    435         git_storage_update_progress("try to update");
     435
    436436        if (!git_reference_cmp(local, remote))
    437437                return 0;
     
    467467        /* Is the remote strictly newer? Use it */
    468468        if (git_oid_equal(&base, local_id)) {
    469                 git_storage_update_progress("fast forward to remote");
     469                git_storage_update_progress(translate("gettextFromC", "Update local storage to match cloud storage"));
    470470                return reset_to_remote(repo, local, remote_id);
    471471        }
     
    475475                if (verbose)
    476476                        fprintf(stderr, "local is newer than remote, update remote\n");
    477                 git_storage_update_progress("git_update_remote, local was newer");
     477                git_storage_update_progress(translate("gettextFromC", "Push local changes to cloud storage"));
    478478                return update_remote(repo, origin, local, remote, rt);
    479479        }
     
    493493        }
    494494        /* Ok, let's try to merge these */
    495         git_storage_update_progress("try to merge");
     495        git_storage_update_progress(translate("gettextFromC", "Try to merge local changes into cloud storage"));
    496496        ret = try_to_git_merge(repo, &local, remote, &base, local_id, remote_id);
    497497        if (ret == 0)
     
    515515        if (verbose)
    516516                fprintf(stderr, "git storage: check remote status\n");
    517         git_storage_update_progress("git check remote status");
    518517
    519518        if (git_branch_lookup(&local_ref, repo, branch, GIT_BRANCH_LOCAL)) {
     
    536535                        opts.callbacks.credentials = credential_https_cb;
    537536                opts.callbacks.certificate_check = certificate_check_cb;
    538                 git_storage_update_progress("git remote push (no remote existed)");
     537                git_storage_update_progress(translate("gettextFromC", "Store data into cloud storage"));
    539538                error = git_remote_push(origin, &refspec, &opts);
    540539        } else {
     
    560559        if (verbose)
    561560                fprintf(stderr, "sync with remote %s[%s]\n", remote, branch);
    562         git_storage_update_progress("sync with remote");
     561        git_storage_update_progress(translate("gettextFromC", "Sync with cloud storage"));
    563562        git_repository_config(&conf, repo);
    564563        if (rt == RT_HTTPS && getProxyString(&proxy_string)) {
     
    587586                // this is not an error, just a warning message, so return 0
    588587                report_error("Cannot connect to cloud server, working with local copy");
    589                 git_storage_update_progress("can't reach cloud server, working with local copy");
     588                git_storage_update_progress(translate("gettextFromC", "Can't reach cloud server, working with local data"));
    590589                return 0;
    591590        }
     
    600599                opts.callbacks.credentials = credential_https_cb;
    601600        opts.callbacks.certificate_check = certificate_check_cb;
    602         git_storage_update_progress("git fetch remote");
     601        git_storage_update_progress(translate("gettextFromC", "Successful cloud connection, fetch remote"));
    603602        error = git_remote_fetch(origin, NULL, &opts, NULL);
    604603        // NOTE! A fetch error is not fatal, we just report it
     
    615614        }
    616615        git_remote_free(origin);
    617         git_storage_update_progress("done with sync with remote");
     616        git_storage_update_progress(translate("gettextFromC", "Done syncing with cloud storage"));
    618617        return error;
    619618}
     
    635634                return NULL;
    636635        }
    637         if (!prefs.git_local_only) {
    638                 git_storage_update_progress("update remote repo");
     636        if (!prefs.git_local_only)
    639637                sync_with_remote(repo, remote, branch, rt);
    640         }
     638
    641639        return repo;
    642640}
     
    774772                fprintf(stderr, "git_remote_repo: accessing %s\n", remote);
    775773        }
    776         git_storage_update_progress("start git interaction");
     774        git_storage_update_progress(translate("gettextFromC", "Synchronising data file"));
    777775        /* Do we already have a local cache? */
    778776        if (!subsurface_stat(localdir, &st)) {
  • core/git-access.h

    rb2b51c8 r2b01ab7  
    3131int git_create_local_repo(const char *filename);
    3232
    33 extern int last_git_storage_update_val;
    34 
    3533#ifdef __cplusplus
    3634}
  • core/load-git.c

    rb2b51c8 r2b01ab7  
    16761676        git_tree *tree;
    16771677
    1678         git_storage_update_progress("do_git_load, find the commit");
    16791678        ret = find_commit(repo, branch, &commit);
    16801679        if (ret)
    16811680                return ret;
    1682         git_storage_update_progress("git commit tree");
    16831681        if (git_commit_tree(&tree, commit))
    16841682                return report_error("Could not look up tree of commit in branch '%s'", branch);
    1685         git_storage_update_progress("load dives from tree");
     1683        git_storage_update_progress(translate("gettextFromC", "Load dives from local cache"));
    16861684        ret = load_dives_from_tree(repo, tree);
    1687         if (!ret)
     1685        if (!ret) {
    16881686                set_git_id(git_commit_id(commit));
     1687                git_storage_update_progress(translate("gettextFromC", "Successfully opened dive data"));
     1688        }
    16891689        git_object_free((git_object *)tree);
    1690         git_storage_update_progress("done do_git_load");
     1690
    16911691        return ret;
    16921692}
  • core/save-git.c

    rb2b51c8 r2b01ab7  
    2424#include "version.h"
    2525#include "qthelperfromc.h"
     26#include "gettext.h"
    2627
    2728#define VA_BUF(b, fmt) do { va_list args; va_start(args, fmt); put_vformat(b, fmt, args); va_end(args); } while (0)
     
    937938        dive_trip_t *trip;
    938939
    939         git_storage_update_progress("start create git tree");
     940        git_storage_update_progress(translate("gettextFromC", "Start saving data"));
    940941        save_settings(repo, root);
    941942
     
    946947
    947948        /* save the dives */
    948         git_storage_update_progress("start saving dives");
     949        git_storage_update_progress(translate("gettextFromC", "Start saving dives"));
    949950        for_each_dive(i, dive) {
    950951                struct tm tm;
     
    979980                save_one_dive(repo, tree, dive, &tm, cached_ok);
    980981        }
    981         git_storage_update_progress("done creating git tree");
     982        git_storage_update_progress(translate("gettextFromC", "Done creating local cache"));
    982983        return 0;
    983984}
     
    12101211
    12111212        if (!create_empty) // so we are actually saving the dives
    1212                 git_storage_update_progress("start git save");
     1213                git_storage_update_progress(translate("gettextFromC", "Preparing to save data"));
    12131214
    12141215        /*
  • mobile-widgets/qmlmanager.cpp

    r4866dd6 r2b01ab7  
    4545{
    4646        static QElapsedTimer timer;
    47         static qint64 lastTime;
     47        static qint64 lastTime = 0;
    4848        static QMLManager *self;
    4949
     
    5959                self->appendTextToLog(text);
    6060                self->setNotificationText(text);
    61                 if (elapsed - lastTime > 500)
    62                         qApp->processEvents();
     61                if (elapsed - lastTime > 50) { // 20 Hz refresh
     62                        qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
     63                }
    6364                lastTime = elapsed;
    6465        }
     
    420421        }
    421422        setCredentialStatus(VALID);
    422         setStartPageText("Cloud credentials valid, loading dives...");
    423         git_storage_update_progress("load dives with valid credentials");
     423        setStartPageText(tr("Cloud credentials valid, loading dives..."));
    424424        // this only gets called with "alreadySaving" already locked
    425425        loadDivesWithValidCredentials();
     
    476476        // for the remote data - which then later gets merged with the remote data if necessary
    477477        if (oldStatus() == NOCLOUD) {
    478                 git_storage_update_progress("import dives from nocloud local storage");
     478                git_storage_update_progress(qPrintable(tr("Loading dives from local storage ('no cloud' mode)")));
    479479                dive_table.preexisting = dive_table.nr;
    480480                mergeLocalRepo();
     
    942942{
    943943        if (unsaved_changes()) {
    944                 git_storage_update_progress("saving dives locally");
    945944                if (credentialStatus() == NOCLOUD) {
    946945                        if (same_string(existing_filename, "")) {
     
    977976                prefs.git_local_only = glo;
    978977                mark_divelist_changed(false);
    979                 git_storage_update_progress("done with local save");
    980978                alreadySaving = false;
    981979        } else {
     
    10081006
    10091007        bool glo = prefs.git_local_only;
    1010         git_storage_update_progress("start save change to cloud");
    10111008        prefs.git_local_only = false;
    10121009        alreadySaving = true;
    10131010        loadDivesWithValidCredentials();
    10141011        alreadySaving = false;
    1015         git_storage_update_progress("finished syncing dive list to cloud server");
    10161012        prefs.git_local_only = glo;
    10171013}
Note: See TracChangeset for help on using the changeset viewer.