예제 #1
0
void CloudView::onRefreshClicked()
{
    if (hasAccount()) {
        showLoadingView();
        refreshRepos();
    }
}
예제 #2
0
CloudView::CloudView(QWidget *parent)
    : QWidget(parent),
      in_refresh_(false),
      list_repo_req_(NULL)
{
    repos_list_ = new ServerReposListView;
    repos_model_ = new ServerReposListModel;
    repos_list_->setModel(repos_model_);

    createLoadingView();

    QStackedLayout *stack = new QStackedLayout;
    stack->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    stack->insertWidget(INDEX_REPOS_LIST, repos_list_);
    setLayout(stack);

    prepareAccountButtonMenu();

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshRepos()));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(setCurrentAccount(const Account&)));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(updateAccountMenu()));

    connect(seafApplet->accountManager(), SIGNAL(accountRemoved(const Account&)),
            this, SLOT(updateAccountMenu()));
}
예제 #3
0
void CloudView::showCreateRepoDialog(const QString& path)
{
    CreateRepoDialog dialog(current_account_, path, this);
    if (dialog.exec() == QDialog::Accepted) {
        refreshRepos();
    }
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    downloader(this),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    curstep = 0;
    totalSteps = 0;
    tempDir = AppPathManager::userAppDir() + "/PGE Content Manager";
    ui->cpack_info_box->setEnabled(false);
    connect(&downloader, SIGNAL(finished()), this, SLOT(downloadSuccess()));
    connect(&downloader, SIGNAL(canceled()), this, SLOT(downloadAborted()));
    connect(&downloader, SIGNAL(failed(QString)), this, SLOT(downloadFailed(QString)));
    connect(&downloader, SIGNAL(progress(qint64, qint64)), this, SLOT(setProgress(qint64, qint64)));
    ui->progressBar->hide();

    cancelStatusBarButton = new QToolButton(ui->statusBar);
    cancelStatusBarButton->setText("x");
    cancelStatusBarButton->setToolTip("Cancel current action.");

    statusBar()->addPermanentWidget(cancelStatusBarButton);

    cancelStatusBarButton->hide();

    connect(cancelStatusBarButton, &QToolButton::clicked, this, &MainWindow::cancelStatusBarButtonClicked);

    if(MainWindow::autoRefresh)
    {
        refreshRepos();
    }

    ui->actionAuto_Refresh_on_Startup->setChecked(MainWindow::autoRefresh);
}
예제 #5
0
void CloudView::setCurrentAccount(const Account& account)
{
    if (current_account_ != account) {
        current_account_ = account;
        in_refresh_ = false;
        showLoadingView();
        refreshRepos();
    }
}
예제 #6
0
CloudView::CloudView(QWidget *parent)
    : QWidget(parent),
      in_refresh_(false),
      list_repo_req_(NULL),
      clone_task_dialog_(NULL)

{
    setupUi(this);

    // seahub_messages_monitor_ = new SeahubMessagesMonitor(this);
    mSeahubMessagesBtn->setVisible(false);

    setupHeader();
    createRepoModelView();
    createLoadingView();
    createLoadingFailedView();
    mStack->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    mStack->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_);
    mStack->insertWidget(INDEX_REPOS_VIEW, repos_tree_);

    createToolBar();
    updateAccountInfoDisplay();
    prepareAccountButtonMenu();

    setupDropArea();
    setupFooter();

    mDropArea->setVisible(false); //disk42

    resizer_ = new QSizeGrip(this);
    resizer_->resize(resizer_->sizeHint());

    refresh_status_bar_timer_ = new QTimer(this);
    connect(refresh_status_bar_timer_, SIGNAL(timeout()), this, SLOT(refreshStatusBar()));

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshRepos()));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(setCurrentAccount(const Account&)));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(updateAccountMenu()));

    connect(seafApplet->accountManager(), SIGNAL(accountRemoved(const Account&)),
            this, SLOT(updateAccountMenu()));
#ifdef Q_WS_MAC
    mHeader->setVisible(false);
#endif
}
예제 #7
0
void CloudView::setCurrentAccount(const Account& account)
{
    if (current_account_ != account) {
        current_account_ = account;
        in_refresh_ = false;
        repos_model_->clear();
        showLoadingView();
        refreshRepos();

        // seahub_messages_monitor_->refresh();

        updateAccountInfoDisplay();
        if (account.isValid()) {
            seafApplet->accountManager()->updateAccountLastVisited(account);
        }
        qDebug("switch to account %s\n", account.username.toUtf8().data());
    }

    refresh_action_->setEnabled(account.isValid());
}