/** Constructor */ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId) : QMainWindow(NULL), mForumId(fId), mParentId(pId) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); Settings->loadWidgetInformation(this); connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) ); connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>))); // connect up the buttons. connect( ui.postmessage_action, SIGNAL( triggered (bool) ), this, SLOT( createMsg( ) ) ); connect( ui.close_action, SIGNAL( triggered (bool) ), this, SLOT( cancelMsg( ) ) ); connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums())); connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile())); connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink())); setAcceptDrops(true); ui.hashBox->setDropWidget(this); ui.hashBox->setAutoHide(false); newMsg(); }
/** Constructor */ CreateForumMsg::CreateForumMsg(const std::string &fId, const std::string &pId) : QDialog(NULL), mForumId(fId), mParentId(pId) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message"); setWindowTitle(text); ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png")); ui.headerFrame->setHeaderText(text); Settings->loadWidgetInformation(this); connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) ); connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>))); // connect up the buttons. connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg())); connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums())); connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile())); connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink())); setAcceptDrops(true); ui.hashBox->setDropWidget(this); ui.hashBox->setAutoHide(false); newMsg(); }
void HashBox::checkAttachmentReady() { if (mHashingInfos.isEmpty()) { return; } QList<HashingInfo>::iterator it; for (it = mHashingInfos.begin(); it != mHashingInfos.end(); ++it) { if (it->item->isHidden()) { continue; } if (!it->item->done()) { break; } } if (it != mHashingInfos.end()) { /* repeat... */ QTimer::singleShot(500, this, SLOT(checkAttachmentReady())); return; } if (mAutoHide) { hide(); } QList<HashedFile> hashedFiles; for (it = mHashingInfos.begin(); it != mHashingInfos.end(); ++it) { HashingInfo& hashingInfo = *it; if (hashingInfo.item->done()) { HashedFile hashedFile; hashedFile.filename = hashingInfo.item->FileName(); hashedFile.filepath = hashingInfo.item->FilePath(); hashedFile.hash = hashingInfo.item->FileHash(); hashedFile.size = hashingInfo.item->FileSize(); hashedFile.flag = hashingInfo.flag; hashedFiles.push_back(hashedFile); ui->verticalLayout->removeWidget(hashingInfo.item); hashingInfo.item->deleteLater(); } } mHashingInfos.clear(); QApplication::processEvents(); // workaround for Qt bug, the size from the first call to QScrollArea::sizeHint() is stored in QWidgetItemV2 and // QScrollArea::sizeHint() is never called again so that widgetResizable of QScrollArea doesn't work // the next line clears the member QScrollArea::widgetSize for recalculation of the removed children in QScrollArea::sizeHint() setWidget(takeWidget()); // the next line set the cache to dirty updateGeometry(); emit fileHashingFinished(hashedFiles); }
/** Constructor */ CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId) : QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); /* Setup Queue */ mForumQueue = new TokenQueue(rsGxsForums->getTokenService(), this); mCirclesQueue = new TokenQueue(rsGxsCircles->getTokenService(), this); /* Setup UI helper */ mStateHelper = new UIStateHelper(this); mStateHelper->addWidget(CREATEGXSFORUMMSG_FORUMINFO, ui.buttonBox->button(QDialogButtonBox::Ok)); mStateHelper->addWidget(CREATEGXSFORUMMSG_FORUMINFO, ui.innerFrame); mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_FORUMINFO, ui.forumName); mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_FORUMINFO, ui.forumSubject); mStateHelper->addClear(CREATEGXSFORUMMSG_FORUMINFO, ui.forumName); mStateHelper->addWidget(CREATEGXSFORUMMSG_PARENTMSG, ui.buttonBox->button(QDialogButtonBox::Ok)); mStateHelper->addWidget(CREATEGXSFORUMMSG_PARENTMSG, ui.innerFrame); mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_PARENTMSG, ui.forumName); mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_PARENTMSG, ui.forumSubject); mStateHelper->addClear(CREATEGXSFORUMMSG_PARENTMSG, ui.forumName); QString text = pId.isNull() ? tr("Start New Thread") : tr("Post Forum Message"); setWindowTitle(text); ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png")); ui.headerFrame->setHeaderText(text); ui.generateSpinBox->setEnabled(false); Settings->loadWidgetInformation(this); connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>))); /* Rename Ok button */ ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Send")); // connect up the buttons. connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums())); connect(ui.attachFileButton, SIGNAL(clicked()), this, SLOT(addFile())); connect(ui.generateCheckBox, SIGNAL(toggled(bool)), ui.generateSpinBox, SLOT(setEnabled(bool))); setAcceptDrops(true); ui.hashBox->setDropWidget(this); ui.hashBox->setAutoHide(false); mParentMsgLoaded = false; mForumMetaLoaded = false; mForumCircleLoaded = false; newMsg(); #ifndef ENABLE_GENERATE ui.generateCheckBox->hide(); ui.generateSpinBox->hide(); #endif }
ChatWidget::ChatWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ChatWidget) { ui->setupUi(this); newMessages = false; typing = false; peerStatus = 0; isChatLobby = false; firstShow = true; inChatCharFormatChanged = false; lastStatusSendTime = 0 ; connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendChat())); connect(ui->addFileButton, SIGNAL(clicked()), this , SLOT(addExtraFile())); connect(ui->textboldButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui->textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui->textitalicButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui->attachPictureButton, SIGNAL(clicked()), this, SLOT(addExtraPicture())); connect(ui->colorButton, SIGNAL(clicked()), this, SLOT(chooseColor())); connect(ui->emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); connect(ui->actionSaveChatHistory, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(ui->actionClearChatHistory, SIGNAL(triggered()), this, SLOT(clearChatHistory())); connect(ui->actionDeleteChatHistory, SIGNAL(triggered()), this, SLOT(deleteChatHistory())); connect(ui->actionMessageHistory, SIGNAL(triggered()), this, SLOT(messageHistory())); connect(ui->actionChooseFont, SIGNAL(triggered()), this, SLOT(chooseFont())); connect(ui->actionResetFont, SIGNAL(triggered()), this, SLOT(resetFont())); connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>))); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int))); connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&))); connect(ui->textBrowser, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTextBrowser(QPoint))); connect(ui->chatTextEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint))); // reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear connect(ui->chatTextEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged())); ui->infoFrame->setVisible(false); ui->statusMessageLabel->hide(); setAcceptDrops(true); ui->chatTextEdit->setAcceptDrops(false); ui->hashBox->setDropWidget(this); ui->hashBox->setAutoHide(true); QMenu *menu = new QMenu(); menu->addAction(ui->actionChooseFont); menu->addAction(ui->actionResetFont); ui->fontButton->setMenu(menu); menu = new QMenu(); menu->addAction(ui->actionClearChatHistory); menu->addAction(ui->actionDeleteChatHistory); menu->addAction(ui->actionSaveChatHistory); menu->addAction(ui->actionMessageHistory); ui->pushtoolsButton->setMenu(menu); ui->chatTextEdit->installEventFilter(this); //#if QT_VERSION < 0x040700 // embedded images are not supported before QT 4.7.0 ui->attachPictureButton->setVisible(false); //#endif resetStatusBar(); }
/** Constructor */ FriendsDialog::FriendsDialog(QWidget *parent) : RsAutoUpdatePage(1500,parent) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); if (instance == NULL) { instance = this; } last_status_send_time = 0 ; inChatCharFormatChanged = false; connect( ui.mypersonalstatusLabel, SIGNAL(clicked()), SLOT(statusmessage())); connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar())); connect( ui.actionSet_your_Personal_Message, SIGNAL(triggered()), this, SLOT(statusmessage())); connect( ui.addfileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); connect( ui.actionAdd_Friend, SIGNAL(triggered()), this, SLOT(addFriend())); connect( ui.actionFriendRecommendations, SIGNAL(triggered()), this, SLOT(recommendFriends())); connect( ui.actionServicePermission, SIGNAL(triggered()), this, SLOT(servicePermission())); connect( ui.filter_lineEdit, SIGNAL(textChanged(QString)), ui.friendList, SLOT(filterItems(QString))); ui.filter_lineEdit->setPlaceholderText(tr("Search")) ; ui.filter_lineEdit->showFilterIcon(); ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME); ui.avatar->setOwnId(); ui.tabWidget->setTabPosition(QTabWidget::North); ui.tabWidget->addTab(networkView = new NetworkView(),QIcon(IMAGE_NETWORK2), tr("Local network")); ui.tabWidget->addTab(networkDialog = new NetworkDialog(),QIcon(IMAGE_PEERS), tr("Known people")); //ui.tabWidget->addTab(new ProfileWidget(), tr("Profile")); //newsFeed = new NewsFeed(); //int newsFeedTabIndex = ui.tabWidget->insertTab(0, newsFeed, tr("News Feed")); //ui.tabWidget->setCurrentIndex(newsFeedTabIndex); ui.tabWidget->hideCloseButton(0); ui.tabWidget->hideCloseButton(1); ui.tabWidget->hideCloseButton(2); ui.tabWidget->hideCloseButton(3); /* get the current text and text color of the tab bar */ //newsFeedTabColor = ui.tabWidget->tabBar()->tabTextColor(newsFeedTabIndex); //newsFeedText = ui.tabWidget->tabBar()->tabText(newsFeedTabIndex); //connect(newsFeed, SIGNAL(newsFeedChanged(int)), this, SLOT(newsFeedChanged(int))); connect(ui.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg())); connect(ui.emoticonBtn, SIGNAL(clicked()), this, SLOT(smileyWidgetgroupchat())); connect(ui.msgText,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenuMsgText(QPoint))); connect(ui.lineEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint))); // reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear connect(ui.lineEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged())); connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textitalicChatButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.fontsButton, SIGNAL(clicked()), this, SLOT(chooseFont())); connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(chooseColor())); connect(ui.actionSave_History, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>))); ui.fontsButton->setIcon(QIcon(QString(":/images/fonts.png"))); mCurrentColor = Qt::black; mCurrentFont.fromString(Settings->getChatScreenFont()); colorChanged(); fontChanged(); setColorAndFont(); style.setStyleFromSettings(ChatStyle::TYPE_PUBLIC); setChatInfo(tr("Welcome to RetroShare's group chat."), QString::fromUtf8("blue")); if (rsHistory->getEnable(true)) { int messageCount = Settings->getPublicChatHistoryCount(); if (messageCount > 0) { std::list<HistoryMsg> historyMsgs; rsHistory->getMessages("", historyMsgs, messageCount); std::list<HistoryMsg>::iterator it; for (it = historyMsgs.begin(); it != historyMsgs.end(); it++) { addChatMsg(it->incoming, true, QString::fromUtf8(it->peerName.c_str()), QDateTime::fromTime_t(it->sendTime), QDateTime::fromTime_t(it->recvTime), QString::fromUtf8(it->message.c_str())); } } } QMenu *menu = new QMenu(); menu->addAction(ui.actionClear_Chat_History); menu->addAction(ui.actionDelete_Chat_History); menu->addAction(ui.actionSave_History); menu->addAction(ui.actionMessageHistory); ui.menuButton->setMenu(menu); menu = new QMenu(); menu->addAction(ui.actionAdd_Friend); menu->addAction(ui.actionAdd_Group); menu->addAction(ui.actionCreate_new_Chat_lobby); menu->addAction(ui.actionFriendRecommendations); menu->addAction(ui.actionServicePermission); menu->addSeparator(); menu->addAction(ui.actionSet_your_Avatar); menu->addAction(ui.actionSet_your_Personal_Message); ui.menutoolButton->setMenu(menu); setAcceptDrops(true); ui.lineEdit->setAcceptDrops(false); ui.hashBox->setDropWidget(this); ui.hashBox->setAutoHide(true); /* Set initial size the splitter */ QList<int> sizes; sizes << height() << 100; // Qt calculates the right sizes ui.splitter_2->setSizes(sizes); loadmypersonalstatus(); ui.displayButton->setMenu(ui.friendList->createDisplayMenu()); // load settings RsAutoUpdatePage::lockAllEvents(); ui.friendList->setShowStatusColumn(true); ui.friendList->setShowLastContactColumn(false); ui.friendList->setShowAvatarColumn(false); ui.friendList->setRootIsDecorated(true); ui.friendList->setShowGroups(true); processSettings(true); RsAutoUpdatePage::unlockAllEvents(); ui.lineEdit->installEventFilter(this); // add self nick and Avatar to Friends. RsPeerDetails pd ; if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) { ui.nicknameLabel->setText(PeerDefs::nameWithLocation(pd)); } /* Hide platform specific features */ #ifdef Q_WS_WIN #endif }
/** * @brief RsCollectionDialog::RsCollectionDialog * @param collectionFileName: Filename of RSCollection saved * @param colFileInfos: Vector of ColFileInfo to be add in intialization * @param creation: Open dialog as RsColl Creation or RsColl DownLoad * @param readOnly: Open dialog for RsColl as ReadOnly */ RsCollectionDialog::RsCollectionDialog(const QString& collectionFileName , const std::vector<ColFileInfo>& colFileInfos , const bool& creation /* = false*/ , const bool& readOnly) : _fileName(collectionFileName), _creationMode(creation) ,_readOnly(readOnly) { ui.setupUi(this) ; uint32_t size = colFileInfos.size(); for(uint32_t i=0;i<size;++i) { const ColFileInfo &colFileInfo = colFileInfos[i]; _newColFileInfos.push_back(colFileInfo); } setWindowFlags(Qt::Window); // for maximize button setWindowFlags(windowFlags() & ~Qt::WindowMinimizeButtonHint); setWindowTitle(QString("%1 - %2").arg(windowTitle()).arg(QFileInfo(_fileName).completeBaseName())); ui.headerFrame->setHeaderImage(QPixmap(":/images/library64.png")); ui.headerFrame->setHeaderText(tr("Collection Editor")); // 1 - add all elements to the list. ui._fileEntriesTW->setColumnCount(COLUMN_COUNT) ; QTreeWidgetItem *headerItem = ui._fileEntriesTW->headerItem(); headerItem->setText(COLUMN_FILE, tr("File")); headerItem->setText(COLUMN_SIZE, tr("Size")); headerItem->setText(COLUMN_HASH, tr("Hash")); headerItem->setText(COLUMN_FILEC, tr("File Count")); bool wrong_chars = !updateList(); // 2 - connect necessary signals/slots connect(ui._changeFile, SIGNAL(clicked()), this, SLOT(changeFileName())); connect(ui._add_PB, SIGNAL(clicked()), this, SLOT(add())); connect(ui._addRecur_PB, SIGNAL(clicked()), this, SLOT(addRecursive())); connect(ui._remove_PB, SIGNAL(clicked()), this, SLOT(remove())); connect(ui._makeDir_PB, SIGNAL(clicked()), this, SLOT(makeDir())); connect(ui._cancel_PB, SIGNAL(clicked()), this, SLOT(cancel())); connect(ui._save_PB, SIGNAL(clicked()), this, SLOT(save())); connect(ui._download_PB, SIGNAL(clicked()), this, SLOT(download())); connect(ui._hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>))); connect(ui._fileEntriesTW, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*,int))); // 3 Initialize List _dirModel = new QFileSystemModel(this); _dirModel->setRootPath("/"); _dirModel->setFilter(QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot); _dirLoaded = false; connect(_dirModel, SIGNAL(directoryLoaded(QString)), this, SLOT(directoryLoaded(QString))); _tree_proxyModel = new FSMSortFilterProxyModel(this); _tree_proxyModel->setDynamicSortFilter(true); _tree_proxyModel->setSourceModel(_dirModel); _tree_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); _tree_proxyModel->setSortRole(Qt::DisplayRole); ui._systemFileTW->setModel(_tree_proxyModel); //Selection Setup _selectionProxy = ui._systemFileTW->selectionModel(); // 4 Restore Configuration // load settings processSettings(true); // 5 Activate button follow creationMode ui._changeFile->setVisible(_creationMode && !_readOnly); ui._makeDir_PB->setVisible(_creationMode && !_readOnly); ui._save_PB->setVisible(_creationMode && !_readOnly); ui._treeViewFrame->setVisible(_creationMode && !_readOnly); ui._download_PB->setVisible(!_creationMode && !_readOnly); ui._fileEntriesTW->installEventFilter(this); ui._systemFileTW->installEventFilter(this); // 6 Add HashBox setAcceptDrops(true); ui._hashBox->setDropWidget(this); ui._hashBox->setAutoHide(true); ui._hashBox->setDefaultTransferRequestFlags(RS_FILE_REQ_ANONYMOUS_ROUTING) ; if(wrong_chars) QMessageBox::warning(NULL,tr("Bad filenames have been cleaned"),tr("Some filenames or directory names contained forbidden characters.\nCharacters <b>\",|,/,\\,<,>,*,?</b> will be replaced by '_'.\n Concerned files are listed in red.")) ; }