StarredFilesTab::StarredFilesTab(QWidget *parent) : TabView(parent), in_refresh_(false) { createStarredFilesListView(); createLoadingView(); createLoadingFailedView(); //createLogoutView logout_view_ = new LogoutView; static_cast<LogoutView*>(logout_view_)->setQssStyleForTab(); createEmptyView(); mStack->insertWidget(INDEX_LOADING_VIEW, loading_view_); mStack->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_); mStack->insertWidget(INDEX_EMPTY_VIEW, empty_view_); mStack->insertWidget(INDEX_LOGOUT_VIEW, logout_view_); mStack->insertWidget(INDEX_FILES_VIEW, files_list_view_); refresh_timer_ = new QTimer(this); connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refresh())); get_starred_files_req_ = NULL; refresh(); }
ActivitiesTab::ActivitiesTab(QWidget *parent) : TabView(parent) { createEventsView(); createLoadingView(); createLoadingFailedView(); //createLogoutView logout_view_ = new LogoutView; static_cast<LogoutView*>(logout_view_)->setQssStyleForTab(); mStack->insertWidget(INDEX_LOADING_VIEW, loading_view_); mStack->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_); mStack->insertWidget(INDEX_LOGOUT_VIEW, logout_view_); mStack->insertWidget(INDEX_EVENTS_VIEW, events_container_view_); connect(EventsService::instance(), SIGNAL(refreshSuccess(const std::vector<SeafEvent>&, bool, bool)), this, SLOT(refreshEvents(const std::vector<SeafEvent>&, bool, bool))); connect(EventsService::instance(), SIGNAL(refreshFailed(const ApiError&)), this, SLOT(refreshFailed(const ApiError&))); connect(AvatarService::instance(), SIGNAL(avatarUpdated(const QString&, const QImage&)), events_list_model_, SLOT(onAvatarUpdated(const QString&, const QImage&))); refresh(); }
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 }
FileBrowserDialog::FileBrowserDialog(const ServerRepo& repo, QWidget *parent) : QDialog(parent), repo_(repo) { current_path_ = "/"; // since root is special, the next step is unnecessary // current_lpath_.push_back(""); const Account& account = seafApplet->accountManager()->currentAccount(); data_mgr_ = new DataManager(account); setWindowTitle(tr("File Browser")); setWindowIcon(QIcon(":/images/seafile.png")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); createToolBar(); createStatusBar(); createLoadingFailedView(); createFileTable(); QVBoxLayout *vlayout = new QVBoxLayout; vlayout->setContentsMargins(0, 6, 0, 0); vlayout->setSpacing(0); setLayout(vlayout); stack_ = new QStackedWidget; stack_->insertWidget(INDEX_LOADING_VIEW, loading_view_); stack_->insertWidget(INDEX_TABLE_VIEW, table_view_); stack_->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_); vlayout->addWidget(toolbar_); vlayout->addWidget(stack_); vlayout->addWidget(status_bar_); connect(table_view_, SIGNAL(direntClicked(const SeafDirent&)), this, SLOT(onDirentClicked(const SeafDirent&))); connect(data_mgr_, SIGNAL(getDirentsSuccess(const QList<SeafDirent>&)), this, SLOT(onGetDirentsSuccess(const QList<SeafDirent>&))); connect(data_mgr_, SIGNAL(getDirentsFailed(const ApiError&)), this, SLOT(onGetDirentsFailed(const ApiError&))); QTimer::singleShot(0, this, SLOT(fetchDirents())); }
StarredFilesTab::StarredFilesTab(QWidget *parent) : TabView(parent), in_refresh_(false) { createStarredFilesListView(); createLoadingView(); createLoadingFailedView(); createEmptyView(); mStack->insertWidget(INDEX_LOADING_VIEW, loading_view_); mStack->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_); mStack->insertWidget(INDEX_EMPTY_VIEW, empty_view_); mStack->insertWidget(INDEX_FILES_VIEW, files_list_view_); refresh_timer_ = new QTimer(this); connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refresh())); refresh_timer_->start(kRefreshInterval); get_starred_files_req_ = NULL; refresh(); }
FileBrowserDialog::FileBrowserDialog(const ServerRepo& repo, QWidget *parent) : QDialog(parent), repo_(repo) { current_path_ = "/"; // since root is special, the next step is unnecessary // current_lpath_.push_back(""); const Account& account = seafApplet->accountManager()->currentAccount(); data_mgr_ = new DataManager(account); setWindowTitle(tr("Cloud File Browser")); setWindowIcon(QIcon(":/images/seafile.png")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint & ~Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::Window); createToolBar(); createStatusBar(); createLoadingFailedView(); createFileTable(); QVBoxLayout *vlayout = new QVBoxLayout; vlayout->setContentsMargins(0, 6, 0, 0); vlayout->setSpacing(0); setLayout(vlayout); stack_ = new QStackedWidget; stack_->insertWidget(INDEX_LOADING_VIEW, loading_view_); stack_->insertWidget(INDEX_TABLE_VIEW, table_view_); stack_->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_); vlayout->addWidget(toolbar_); vlayout->addWidget(stack_); vlayout->addWidget(status_bar_); // this <--> table_view_ connect(table_view_, SIGNAL(direntClicked(const SeafDirent&)), this, SLOT(onDirentClicked(const SeafDirent&))); connect(table_view_, SIGNAL(direntRename(const SeafDirent&)), this, SLOT(onGetDirentRename(const SeafDirent&))); connect(table_view_, SIGNAL(direntRemove(const SeafDirent&)), this, SLOT(onGetDirentRemove(const SeafDirent&))); connect(table_view_, SIGNAL(direntShare(const SeafDirent&)), this, SLOT(onGetDirentShare(const SeafDirent&))); connect(table_view_, SIGNAL(direntUpdate(const SeafDirent&)), this, SLOT(onGetDirentUpdate(const SeafDirent&))); connect(table_view_, SIGNAL(cancelDownload(const SeafDirent&)), this, SLOT(onCancelDownload(const SeafDirent&))); //dirents <--> data_mgr_ connect(data_mgr_, SIGNAL(getDirentsSuccess(const QList<SeafDirent>&)), this, SLOT(onGetDirentsSuccess(const QList<SeafDirent>&))); connect(data_mgr_, SIGNAL(getDirentsFailed(const ApiError&)), this, SLOT(onGetDirentsFailed(const ApiError&))); //create <--> data_mgr_ connect(data_mgr_, SIGNAL(createDirectorySuccess(const QString&)), this, SLOT(onDirectoryCreateSuccess(const QString&))); connect(data_mgr_, SIGNAL(createDirectoryFailed(const ApiError&)), this, SLOT(onDirectoryCreateFailed(const ApiError&))); //rename <--> data_mgr_ connect(data_mgr_, SIGNAL(renameDirentSuccess(const QString&, const QString&)), this, SLOT(onDirentRenameSuccess(const QString&, const QString&))); connect(data_mgr_, SIGNAL(renameDirentFailed(const ApiError&)), this, SLOT(onDirentRenameFailed(const ApiError&))); //remove <--> data_mgr_ connect(data_mgr_, SIGNAL(removeDirentSuccess(const QString&)), this, SLOT(onDirentRemoveSuccess(const QString&))); connect(data_mgr_, SIGNAL(removeDirentFailed(const ApiError&)), this, SLOT(onDirentRemoveFailed(const ApiError&))); //share <--> data_mgr_ connect(data_mgr_, SIGNAL(shareDirentSuccess(const QString&)), this, SLOT(onDirentShareSuccess(const QString&))); connect(data_mgr_, SIGNAL(shareDirentFailed(const ApiError&)), this, SLOT(onDirentShareFailed(const ApiError&))); connect(AutoUpdateManager::instance(), SIGNAL(fileUpdated(const QString&, const QString&)), this, SLOT(onFileAutoUpdated(const QString&, const QString&))); QTimer::singleShot(0, this, SLOT(fetchDirents())); }
FileBrowserDialog::FileBrowserDialog(const Account &account, const ServerRepo& repo, const QString &path, QWidget *parent) : QDialog(parent), account_(account), repo_(repo), current_path_(path) { current_lpath_ = current_path_.split('/'); data_mgr_ = new DataManager(account_); setWindowTitle(tr("Cloud File Browser")); setWindowIcon(QIcon(":/images/seafile.png")); setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint & ~Qt::Dialog) #if !defined(Q_OS_MAC) | Qt::FramelessWindowHint #endif #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) | Qt::WindowMinimizeButtonHint #endif | Qt::Window); resizer_ = new QSizeGrip(this); resizer_->resize(resizer_->sizeHint()); setAttribute(Qt::WA_TranslucentBackground, true); createTitleBar(); createToolBar(); createStatusBar(); createLoadingFailedView(); createFileTable(); QWidget* widget = new QWidget; widget->setObjectName("mainWidget"); QVBoxLayout* layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); setLayout(layout); layout->addWidget(widget); QVBoxLayout *vlayout = new QVBoxLayout; vlayout->setContentsMargins(1, 0, 1, 0); vlayout->setSpacing(0); widget->setLayout(vlayout); stack_ = new QStackedWidget; stack_->insertWidget(INDEX_LOADING_VIEW, loading_view_); stack_->insertWidget(INDEX_TABLE_VIEW, table_view_); stack_->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_); stack_->setContentsMargins(0, 0, 0, 0); vlayout->addWidget(header_); vlayout->addWidget(toolbar_); vlayout->addWidget(stack_); vlayout->addWidget(status_bar_); #ifdef Q_OS_MAC header_->setVisible(false); #endif // this <--> table_view_ connect(table_view_, SIGNAL(direntClicked(const SeafDirent&)), this, SLOT(onDirentClicked(const SeafDirent&))); connect(table_view_, SIGNAL(direntSaveAs(const SeafDirent&)), this, SLOT(onDirentSaveAs(const SeafDirent&))); connect(table_view_, SIGNAL(direntRename(const SeafDirent&)), this, SLOT(onGetDirentRename(const SeafDirent&))); connect(table_view_, SIGNAL(direntRemove(const SeafDirent&)), this, SLOT(onGetDirentRemove(const SeafDirent&))); connect(table_view_, SIGNAL(direntRemove(const QList<const SeafDirent*> &)), this, SLOT(onGetDirentRemove(const QList<const SeafDirent*> &))); connect(table_view_, SIGNAL(direntShare(const SeafDirent&)), this, SLOT(onGetDirentShare(const SeafDirent&))); connect(table_view_, SIGNAL(direntUpdate(const SeafDirent&)), this, SLOT(onGetDirentUpdate(const SeafDirent&))); connect(table_view_, SIGNAL(direntPaste()), this, SLOT(onGetDirentsPaste())); connect(table_view_, SIGNAL(cancelDownload(const SeafDirent&)), this, SLOT(onCancelDownload(const SeafDirent&))); connect(table_view_, SIGNAL(syncSubdirectory(const QString&)), this, SLOT(onGetSyncSubdirectory(const QString &))); //dirents <--> data_mgr_ connect(data_mgr_, SIGNAL(getDirentsSuccess(const QList<SeafDirent>&)), this, SLOT(onGetDirentsSuccess(const QList<SeafDirent>&))); connect(data_mgr_, SIGNAL(getDirentsFailed(const ApiError&)), this, SLOT(onGetDirentsFailed(const ApiError&))); //create <--> data_mgr_ connect(data_mgr_, SIGNAL(createDirectorySuccess(const QString&)), this, SLOT(onDirectoryCreateSuccess(const QString&))); connect(data_mgr_, SIGNAL(createDirectoryFailed(const ApiError&)), this, SLOT(onDirectoryCreateFailed(const ApiError&))); //rename <--> data_mgr_ connect(data_mgr_, SIGNAL(renameDirentSuccess(const QString&, const QString&)), this, SLOT(onDirentRenameSuccess(const QString&, const QString&))); connect(data_mgr_, SIGNAL(renameDirentFailed(const ApiError&)), this, SLOT(onDirentRenameFailed(const ApiError&))); //remove <--> data_mgr_ connect(data_mgr_, SIGNAL(removeDirentSuccess(const QString&)), this, SLOT(onDirentRemoveSuccess(const QString&))); connect(data_mgr_, SIGNAL(removeDirentFailed(const ApiError&)), this, SLOT(onDirentRemoveFailed(const ApiError&))); //share <--> data_mgr_ connect(data_mgr_, SIGNAL(shareDirentSuccess(const QString&)), this, SLOT(onDirentShareSuccess(const QString&))); connect(data_mgr_, SIGNAL(shareDirentFailed(const ApiError&)), this, SLOT(onDirentShareFailed(const ApiError&))); //copy <--> data_mgr_ connect(data_mgr_, SIGNAL(copyDirentsSuccess()), this, SLOT(onDirentsCopySuccess())); connect(data_mgr_, SIGNAL(copyDirentsFailed(const ApiError&)), this, SLOT(onDirentsCopyFailed(const ApiError&))); //move <--> data_mgr_ connect(data_mgr_, SIGNAL(moveDirentsSuccess()), this, SLOT(onDirentsMoveSuccess())); connect(data_mgr_, SIGNAL(moveDirentsFailed(const ApiError&)), this, SLOT(onDirentsMoveFailed(const ApiError&))); //subrepo <-->data_mgr_ connect(data_mgr_, SIGNAL(createSubrepoSuccess(const ServerRepo &)), this, SLOT(onCreateSubrepoSuccess(const ServerRepo &))); connect(data_mgr_, SIGNAL(createSubrepoFailed(const ApiError&)), this, SLOT(onCreateSubrepoFailed(const ApiError&))); connect(AutoUpdateManager::instance(), SIGNAL(fileUpdated(const QString&, const QString&)), this, SLOT(onFileAutoUpdated(const QString&, const QString&))); QTimer::singleShot(0, this, SLOT(fetchDirents())); }