// Child windows functions void MainWindow::createChildWindows() { currentRecipient = ALL_FRIENDS_ID; // Creating drawing window drawingWindow = new DrawingWindow(this); connect(drawingWindow, SIGNAL(clipartWindowRequest()), this, SLOT(onShowClipart())); connect(drawingWindow, SIGNAL(messageSent()), this, SLOT(onMessageSent())); connect(drawingWindow, SIGNAL(replyChanged()), tvWidget, SLOT(replyChanged())); drawingWindow->updatePosition(this); historyWindow = new HistoryWindow(this); historyWindow->setTvWidget(tvWidget); connect(historyWindow, SIGNAL(beginOfPreview(const MessageKey &)), tvWidget, SLOT(showHistoryMessage(const MessageKey &))); connect(historyWindow, SIGNAL(endOfPreview()), tvWidget, SLOT(stopShowingHistory())); connect(historyWindow, SIGNAL(clicked(const MessageKey &)), tvWidget, SLOT(scrollToMessage(const MessageKey &))); connect(historyWindow, SIGNAL(deleteMessages(const QList<MessageKey> &)), tvWidget, SLOT(deleteMessages(const QList<MessageKey> &))); connect(historyWindow, SIGNAL(saveMessage()), tvWidget, SLOT(saveMessage())); connect(historyWindow, SIGNAL(copyMessage()), tvWidget, SLOT(copyMessage())); connect(tvWidget, SIGNAL(publishRequest(const MessageKey &)), historyWindow, SLOT(publishMessage(const MessageKey &))); historyWindow->updatePosition(this); contactList = new NewContactListWindow(this); contactList->updatePosition(this); contactList->initAutoUpdater(&autoUpdater); // Connect menu signals connect(contactList, SIGNAL(goOnline()), this, SLOT(relogon())); connect(contactList, SIGNAL(goOffline()), this, SLOT(offline())); connect(contactList, SIGNAL(goLogout()), this, SLOT(logout())); connect(contactList, SIGNAL(goExit()), this, SLOT(shutDown())); connect(contactList, SIGNAL(contactSelected(qint32)), this, SLOT(onContactSelected(qint32))); connect(contactList, SIGNAL(contactImageDrop(qint32, const QImage &)), this, SLOT(onContactImageDrop(qint32, const QImage &))); connect(contactList, SIGNAL(soundStateChanged(const bool)), this, SLOT(onSoundStateChanged(const bool))); connect(contactList, SIGNAL(unreadContacts(int)), contactListButton, SLOT(update(int))); #ifdef Q_WS_MAC connect(contactList, SIGNAL(unreadContacts(int)), DockIconHandler::instance(), SLOT(unreadCountChanged(int))); #endif connect(contactList, SIGNAL(historyCleared()), tvWidget, SLOT(reload())); connect(welcomeWidget, SIGNAL(showProfileDialog()), contactList, SLOT(onShowProfileDialog())); connect(welcomeWidget, SIGNAL(showFindFriendsDialog()), contactList, SLOT(onShowFindDialog())); }
ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ReceiveCoinsDialog), model(0) { ui->setupUi(this); #ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac ui->clearButton->setIcon(QIcon()); ui->receiveButton->setIcon(QIcon()); ui->showRequestButton->setIcon(QIcon()); ui->removeRequestButton->setIcon(QIcon()); #endif // context menu actions QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyMessageAction = new QAction(tr("Copy message"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); // context menu contextMenu = new QMenu(); contextMenu->addAction(copyLabelAction); contextMenu->addAction(copyMessageAction); contextMenu->addAction(copyAmountAction); // context menu signals connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage())); connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); }
bool MessageFolder::copyMessages(const QMailMessageIdList& ids) { bool rv(true); foreach (const QMailMessageId &id, ids) rv &= copyMessage(id); return rv; }
void BaseRpcChannel::processResponse( const string& responseMsg ) { try { istringstream in( responseMsg ); int msgType = Util::readInt( in ); switch( msgType ) { case RpcMessage::RESPONSE_MSG: { string callId; RpcController controller; shared_ptr<Message> response; //parse the response RpcMessage::parseResponseFrom( in, callId, controller, response ); GOOGLE_LOG( INFO ) << "received a response message, callId:" << callId; //if the response is still not timeout shared_ptr<ResponseParam> respParam = waitingResponses_->erase( callId ); if( respParam ) { timer_->cancel( callId ); RpcController* pController = dynamic_cast<RpcController*>( respParam->controller ); if( pController ) { copyController( *pController, controller ); } if( respParam->response && response ) { copyMessage( *(respParam->response), *response ); } if( respParam->completed ) { { boost::lock_guard<boost::mutex> lock(mMutex); *(respParam->completed) = true; } mCondVariable.notify_all(); } if( respParam->done ) { respParam->done->Run(); } if( pController ) { pController->complete(); } } } break; } }catch( const std::exception& ex) { GOOGLE_LOG( ERROR ) << "catch exception:" << ex.what() ; } catch( ... ) { GOOGLE_LOG( ERROR ) << "catch unknown exception"; } }
/** Default constructor */ ImHistoryBrowser::ImHistoryBrowser(const ChatId &chatId, QTextEdit *edit, QWidget *parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint) { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); ui.headerFrame->setHeaderImage(QPixmap(":/images/user/agt_forum64.png")); ui.headerFrame->setHeaderText(tr("Message History")); m_chatId = chatId; textEdit = edit; connect(NotifyQt::getInstance(), SIGNAL(historyChanged(uint, int)), this, SLOT(historyChanged(uint, int))); connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString))); connect(ui.copyButton, SIGNAL(clicked()), SLOT(copyMessage())); connect(ui.removeButton, SIGNAL(clicked()), SLOT(removeMessages())); connect(ui.listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelectionChanged())); connect(ui.listWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint))); ui.filterLineEdit->showFilterIcon(); // embed smileys ? if (m_chatId.isPeerId() || m_chatId.isGxsId()) { embedSmileys = Settings->valueFromGroup("Chat", "Emoteicons_PrivatChat", true).toBool(); } else { embedSmileys = Settings->valueFromGroup("Chat", "Emoteicons_GroupChat", true).toBool(); } style.setStyleFromSettings(ChatStyle::TYPE_HISTORY); ui.listWidget->setItemDelegate(new IMHistoryItemDelegate); QByteArray geometry = Settings->valueFromGroup("HistorieBrowser", "Geometry", QByteArray()).toByteArray(); if (geometry.isEmpty() == false) { restoreGeometry(geometry); } // dummy call for set buttons itemSelectionChanged(); ui.listWidget->installEventFilter(this); m_createThread = new ImHistoryBrowserCreateItemsThread(this, m_chatId); connect(m_createThread, SIGNAL(finished()), this, SLOT(createThreadFinished())); connect(m_createThread, SIGNAL(progress(int,int)), this, SLOT(createThreadProgress(int,int))); m_createThread->start(); }
UEFITool::UEFITool(QWidget *parent) : QMainWindow(parent), ui(new Ui::UEFITool), version(tr("0.18.7")) { clipboard = QApplication::clipboard(); // Create UI ui->setupUi(this); searchDialog = new SearchDialog(this); ffsEngine = NULL; // Set window title this->setWindowTitle(tr("UEFITool %1").arg(version)); // Connect signals to slots connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile())); connect(ui->actionSaveImageFile, SIGNAL(triggered()), this, SLOT(saveImageFile())); connect(ui->actionSearch, SIGNAL(triggered()), this, SLOT(search())); connect(ui->actionExtract, SIGNAL(triggered()), this, SLOT(extractAsIs())); connect(ui->actionExtractBody, SIGNAL(triggered()), this, SLOT(extractBody())); connect(ui->actionInsertInto, SIGNAL(triggered()), this, SLOT(insertInto())); connect(ui->actionInsertBefore, SIGNAL(triggered()), this, SLOT(insertBefore())); connect(ui->actionInsertAfter, SIGNAL(triggered()), this, SLOT(insertAfter())); connect(ui->actionReplace, SIGNAL(triggered()), this, SLOT(replaceAsIs())); connect(ui->actionReplaceBody, SIGNAL(triggered()), this, SLOT(replaceBody())); connect(ui->actionRemove, SIGNAL(triggered()), this, SLOT(remove())); connect(ui->actionRebuild, SIGNAL(triggered()), this, SLOT(rebuild())); connect(ui->actionMessagesCopy, SIGNAL(triggered()), this, SLOT(copyMessage())); connect(ui->actionMessagesCopyAll, SIGNAL(triggered()), this, SLOT(copyAllMessages())); connect(ui->actionMessagesClear, SIGNAL(triggered()), this, SLOT(clearMessages())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(aboutQt())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(exit())); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(writeSettings())); // Enable Drag-and-Drop actions this->setAcceptDrops(true); // Set current directory currentDir = "."; // Initialize non-persistent data init(); // Read stored settings readSettings(); }
ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent), ui(new Ui::ReceiveCoinsDialog), columnResizingFixer(0), model(0), platformStyle(_platformStyle) { ui->setupUi(this); if (!_platformStyle->getImagesOnButtons()) { ui->clearButton->setIcon(QIcon()); ui->receiveButton->setIcon(QIcon()); ui->showRequestButton->setIcon(QIcon()); ui->removeRequestButton->setIcon(QIcon()); } else { //ui->clearButton->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); ui->clearButton->setIcon(QIcon(":/icons/arrow_right")); ui->receiveButton->setIcon(QIcon(":/icons/send")); ui->showRequestButton->setIcon(QIcon(":/icons/arrow_right")); ui->removeRequestButton->setIcon(QIcon(":/icons/arrow_right")); ui->clearButton->setLayoutDirection(Qt::RightToLeft); ui->showRequestButton->setLayoutDirection(Qt::RightToLeft); ui->removeRequestButton->setLayoutDirection(Qt::RightToLeft); } ui->recentRequestsView->setShowGrid(false); // context menu actions QAction *copyURIAction = new QAction(tr("Copy URI"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyMessageAction = new QAction(tr("Copy message"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); // context menu contextMenu = new QMenu(this); contextMenu->addAction(copyURIAction); contextMenu->addAction(copyLabelAction); contextMenu->addAction(copyMessageAction); contextMenu->addAction(copyAmountAction); // context menu signals connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); connect(copyURIAction, SIGNAL(triggered()), this, SLOT(copyURI())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage())); connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); }
void MessageQueue::copyAllMessages(MessageQueue& other) { if(queue.usedSize >= MessageQueueBase::headerSize) { char* dest = other.queue.reserve(queue.usedSize - MessageQueueBase::headerSize); if(dest) { memcpy(dest - MessageQueueBase::headerSize, queue.buf, queue.usedSize); other.queue.numberOfMessages += queue.numberOfMessages; other.queue.usedSize += queue.usedSize; other.queue.writePosition = 0; } else // Not all messages fit in there, so try step by step (some will be missing). for(int i = 0; i < queue.numberOfMessages; ++i) copyMessage(i, other); } }
ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent), ui(new Ui::ReceiveCoinsDialog), columnResizingFixer(0), model(0), platformStyle(_platformStyle) { ui->setupUi(this); QString theme = GUIUtil::getThemeName(); if (!_platformStyle->getImagesOnButtons()) { ui->clearButton->setIcon(QIcon()); ui->receiveButton->setIcon(QIcon()); ui->showRequestButton->setIcon(QIcon()); ui->removeRequestButton->setIcon(QIcon()); } else { ui->clearButton->setIcon(_platformStyle->SingleColorIcon(":/icons/" + theme + "/remove")); ui->receiveButton->setIcon(_platformStyle->SingleColorIcon(":/icons/" + theme + "/receiving_addresses")); ui->showRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/" + theme + "/edit")); ui->removeRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/" + theme + "/remove")); } // context menu actions QAction *copyURIAction = new QAction(tr("Copy URI"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyMessageAction = new QAction(tr("Copy message"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); // context menu contextMenu = new QMenu(this); contextMenu->addAction(copyURIAction); contextMenu->addAction(copyLabelAction); contextMenu->addAction(copyMessageAction); contextMenu->addAction(copyAmountAction); // context menu signals connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); connect(copyURIAction, SIGNAL(triggered()), this, SLOT(copyURI())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage())); connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); }
/* * Total Order Broadcast with good throughput. * Note that like every functions defined here, they have the type NodesFct. */ void TOBThroughputBroadcast(int id, Message m){ PipelineAckData_t data; int argSize, ackOrigin; char *event, *eventArg, *msgTxt; Message mOut; NumberedMessage NumMsg, temp; if((data=(PipelineAckData_t)getData(id))==NULL){ //Initialization if((data=malloc(sizeof(struct _PipleineAckData_t)))==NULL){ fprintf(stderr,"malloc fail at TOBThroughputBroadcast\n"); exit(EXIT_FAILURE); } data->clock=0; data->next=(id+1)%getNbNodes(); // data->pred=(id==0)?getNbNodes()-1:id-1; data->pending=newSortedList(NumberedMsgComp); setData(id,data); } if(m==NULL){ // Event Rules if((event = getNextExternalEvent(id)) != NULL){ printf("event received %i %s\n",id, event); // Read the first event if(event==strstr(event, "broadcast")){ //there is an event : increment the clock data->clock++; //event is someting like broadcast <string> if((eventArg=malloc(sizeof(char)*maxArgSize))==NULL){ fprintf(stderr,"malloc fail at TOBThroughputBroadcast\n"); exit(EXIT_FAILURE); } if(1>sscanf(event, "broadcast %s", eventArg)){ sscanf("hello","%s",eventArg); } //eventArg is either the string to broadcast, or "hello" argSize=strlen(eventArg); if((msgTxt=malloc((intToStringSize+1+argSize)*sizeof(char)))==NULL){ fprintf(stderr,"malloc fail at TOBThroughputBroadcast\n"); exit(EXIT_FAILURE); } sprintf(msgTxt, "%d ",data->clock); strncat(msgTxt, eventArg, argSize); //Now the message text have the format: clk <arg> if((NumMsg=malloc(sizeof(struct _NumberedMessage)))==NULL){ fprintf(stderr,"malloc fail at TOBThroughputBroadcast\n"); exit(EXIT_FAILURE); } NumMsg->clk=data->clock; //waiting for 1 ack //creating the actual message NumMsg->m=initMessage(msgTxt,id,id,data->next); free(msgTxt); NumMsg->origin=id; if(data->next==id){ //we are the only process of the system deliver(NumMsg->m,id); free(NumMsg->m->msg); free(NumMsg->m); free(NumMsg); }else{ //and send it Send(copyMessage(NumMsg->m)); //Finally store the numbered msg in the pending list AddSorted(NumMsg,data->pending); } } free(event); } }else{ // Message Rules if((NumMsg=malloc(sizeof(struct _NumberedMessage)))==NULL){ fprintf(stderr,"malloc fail at TOBThroughputBroadcast\n"); exit(EXIT_FAILURE); } //this is a new message at the format: //clock <text> where text is either ack or the text of the //message //We have to parse the clock of the broadcast extractInt(m->msg, &(NumMsg->clk)); NumMsg->origin=m->origin; //don't forget to update the clock data->clock=MAX(NumMsg->clk,data->clock)+1; if(strstr(m->msg,"ack")==NULL){ printf("%s received by %d from %d but not delivered yet\n", m->msg, id, m->sender); //m is an actual message NumMsg->m=m; if(m->origin!=data->next){ //We need to forward the message mOut=initMessage(m->msg,m->origin,id,data->next); Send(mOut); AddSorted(NumMsg,data->pending); }else{ AddSorted(NumMsg,data->pending); //we deliver all the older messages mOut=NULL; while((temp=getFirst(data->pending))!=NULL && NumMsg!=NULL && NumberedMsgComp(temp,NumMsg)<=0){ //we remove the message from the pending list RemoveFirst(data->pending); if(!NumberedMsgComp(temp,NumMsg)){ //to ensure we stop after that NumMsg=NULL; } //prepare an ack if(temp->origin!=id){ if(mOut!=NULL){ free(mOut); } mOut=Ack(temp->clk,temp->origin,id,data->next); } //deliver deliver(temp->m,id); //we can free the message free(temp->m->msg); free(temp->m); free(temp); } //if we have managed to deliver a message //we acknowleged the older message delvered if(mOut){ Send(mOut); } } }else{ //this is an ack printf("%s received by %d from %d origin %d\n", m->msg, id, m->sender, m->origin); //we deliver all the older messages mOut=NULL; while((temp=getFirst(data->pending))!=NULL && NumMsg!=NULL && NumberedMsgComp(temp,NumMsg)<=0){ //we remove the message from the pending list RemoveFirst(data->pending); //prepare an ack ackOrigin=((temp->origin+getNbNodes()-1)%getNbNodes()); if(ackOrigin!=data->next){ if(mOut!=NULL){ free(mOut); } mOut=Ack(temp->clk,temp->origin,id,data->next); } //deliver deliver(temp->m,id); //we can free the message free(temp->m->msg); free(temp->m); free(temp); } //if we have managed to deliver a message //we acknowleged the older message delvered ackOrigin=((NumMsg->origin+getNbNodes()-1)%getNbNodes()); if(mOut){ Send(mOut); }else if(Size(data->pending)==0 && ackOrigin!=data->next){ //we haven't be able to deliver a message because our pending //list is empty, but the message may be blocked in someon else //queue so we forward the ack Send(Ack(NumMsg->clk,NumMsg->origin,id,data->next)); } // Free the local message free(m->msg); free(m); } } }
UEFITool::UEFITool(QWidget *parent) : QMainWindow(parent), ui(new Ui::UEFITool), version(tr("0.20.4")) { clipboard = QApplication::clipboard(); // Create UI ui->setupUi(this); searchDialog = new SearchDialog(this); ffsEngine = NULL; // Set window title this->setWindowTitle(tr("UEFITool %1").arg(version)); // Connect signals to slots connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile())); connect(ui->actionSaveImageFile, SIGNAL(triggered()), this, SLOT(saveImageFile())); connect(ui->actionSearch, SIGNAL(triggered()), this, SLOT(search())); connect(ui->actionExtract, SIGNAL(triggered()), this, SLOT(extractAsIs())); connect(ui->actionExtractBody, SIGNAL(triggered()), this, SLOT(extractBody())); connect(ui->actionInsertInto, SIGNAL(triggered()), this, SLOT(insertInto())); connect(ui->actionInsertBefore, SIGNAL(triggered()), this, SLOT(insertBefore())); connect(ui->actionInsertAfter, SIGNAL(triggered()), this, SLOT(insertAfter())); connect(ui->actionReplace, SIGNAL(triggered()), this, SLOT(replaceAsIs())); connect(ui->actionReplaceBody, SIGNAL(triggered()), this, SLOT(replaceBody())); connect(ui->actionRemove, SIGNAL(triggered()), this, SLOT(remove())); connect(ui->actionRebuild, SIGNAL(triggered()), this, SLOT(rebuild())); connect(ui->actionMessagesCopy, SIGNAL(triggered()), this, SLOT(copyMessage())); connect(ui->actionMessagesCopyAll, SIGNAL(triggered()), this, SLOT(copyAllMessages())); connect(ui->actionMessagesClear, SIGNAL(triggered()), this, SLOT(clearMessages())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(aboutQt())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(exit())); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(writeSettings())); // Enable Drag-and-Drop actions this->setAcceptDrops(true); // Set current directory currentDir = "."; // Set monospace font for some controls QFont font("Courier New", 10); #if defined Q_OS_OSX font = QFont("Menlo", 10); #elif defined Q_OS_WIN font = QFont("Consolas", 9); #endif ui->infoEdit->setFont(font); ui->messageListWidget->setFont(font); ui->structureTreeView->setFont(font); searchDialog->ui->guidEdit->setFont(font); searchDialog->ui->hexEdit->setFont(font); // Initialize non-persistent data init(); // Read stored settings readSettings(); }
LatexLogWidget::LatexLogWidget(QWidget *parent) : QWidget(parent), logModel(0), displayPartsActions(0),filterErrorAction(0),filterWarningAction(0),filterBadBoxAction(0),logpresent(false) { logModel = new LatexLogModel(this);//needs loaded line marks errorTable = new QTableView(this); int rowHeight = getOptimalRowHeight(errorTable); errorTable->verticalHeader()->setDefaultSectionSize(rowHeight); QFontMetrics fm(QApplication::font()); errorTable->setSelectionBehavior(QAbstractItemView::SelectRows); errorTable->setSelectionMode(QAbstractItemView::SingleSelection); errorTable->setColumnWidth(0,fm.width("> ")); errorTable->setColumnWidth(1,20*fm.width("w")); errorTable->setColumnWidth(2,fm.width("WarningW")); errorTable->setColumnWidth(3,fm.width("Line WWWWW")); errorTable->setColumnWidth(4,20*fm.width("w")); connect(errorTable, SIGNAL(clicked(const QModelIndex &)), this, SLOT(clickedOnLogModelIndex(const QModelIndex &))); errorTable->horizontalHeader()->setStretchLastSection(true); errorTable->setMinimumHeight(5*rowHeight); errorTable->setFrameShape(QFrame::NoFrame); errorTable->setSortingEnabled(true); proxyModel = new QSortFilterProxyModel(this); proxyModel->setSourceModel(logModel); errorTable->setModel(proxyModel); QAction * act = new QAction(tr("&Copy"),errorTable); connect(act, SIGNAL(triggered()), SLOT(copyMessage())); errorTable->addAction(act); act = new QAction(tr("&Copy All"),errorTable); connect(act, SIGNAL(triggered()), SLOT(copyAllMessages())); errorTable->addAction(act); act = new QAction(tr("&Copy All With Line Numbers"),errorTable); connect(act, SIGNAL(triggered()), SLOT(copyAllMessagesWithLineNumbers())); errorTable->addAction(act); errorTable->setContextMenuPolicy(Qt::ActionsContextMenu); log = new LogEditor(this); log->setFocusPolicy(Qt::ClickFocus); log->setMinimumHeight(3*(fm.lineSpacing()+4)); log->setReadOnly(true); connect(log, SIGNAL(clickOnLogLine(int)),this,SLOT(gotoLogLine(int))); QSplitter *splitter = new QSplitter(Qt::Vertical, this); splitter->setChildrenCollapsible(false); splitter->addWidget(errorTable); splitter->addWidget(log); infoLabel = new QLabel(tr("No log file available"), this); infoLabel->setStyleSheet("background: #FFFBBF;"); infoLabel->setMargin(2); QVBoxLayout* vLayout = new QVBoxLayout(); //contains the widgets for the normal mode (OutputTable + OutputLogTextEdit) vLayout->setSpacing(0); vLayout->setMargin(0); vLayout->addWidget(infoLabel); vLayout->addWidget(splitter); setLayout(vLayout); displayPartsActions = new QActionGroup(this); displayPartsActions->setExclusive(true); connect(displayPartsActions, SIGNAL(triggered(QAction*)), this, SLOT(changeDisplay(QAction *))); displayTableAction = new QAction(tr("Issues"), displayPartsActions); displayTableAction->setData(qVariantFromValue(DisplayTable)); displayTableAction->setCheckable(true); displayLogAction = new QAction(tr("Log File"), displayPartsActions); displayLogAction->setData(qVariantFromValue(DisplayLog)); displayLogAction->setCheckable(true); displayLogAndTableAction = new QAction(tr("Issues and Log"), displayPartsActions); displayLogAndTableAction->setData(qVariantFromValue(DisplayLogAndTable)); displayLogAndTableAction->setCheckable(true); filterErrorAction = new QAction(QIcon(":/images-ng/error.svgz"),tr("Show Error"),this); filterErrorAction->setCheckable(true); filterErrorAction->setChecked(true); connect(filterErrorAction,SIGNAL(toggled(bool)),this,SLOT(filterChanged(bool))); filterWarningAction = new QAction(QIcon(":/images-ng/warning.svgz"),tr("Show Warning"),this); filterWarningAction->setCheckable(true); filterWarningAction->setChecked(true); connect(filterWarningAction,SIGNAL(toggled(bool)),this,SLOT(filterChanged(bool))); filterBadBoxAction = new QAction(QIcon(":/images-ng/badbox.svg"),tr("Show BadBox"),this); filterBadBoxAction->setCheckable(true); filterBadBoxAction->setChecked(true); connect(filterBadBoxAction,SIGNAL(toggled(bool)),this,SLOT(filterChanged(bool))); setDisplayParts(DisplayTable); }
void LatexLogWidget::copy() { if (displayLogAction->isChecked() || displayLogAndTableAction->isChecked()) log->copy(); else copyMessage(); }