jRoster::jRoster(const QString &account_name, const QString &profile_name, jAccount *jabber_account) : m_account_name(account_name), m_profile_name(profile_name), m_plugin_system(jPluginSystem::instance()), m_list_string(QChar(0)+QString("list")), m_jabber_account(jabber_account) { QSettings account_settings(QSettings::NativeFormat, QSettings::UserScope, "qutim/qutim."+m_profile_name/*+"/jabber."+m_account_name*/, "jabbericons"); m_path_to_avatars = account_settings.fileName(); m_path_to_avatars.truncate(m_path_to_avatars.length()-4); m_add_contact_action = new QAction(m_plugin_system.getIcon("add_user"),tr("Add to contact list"),this); connect(m_add_contact_action,SIGNAL(triggered()),this,SLOT(onAddContact())); m_rename_action = new QAction(m_plugin_system.getIcon("edituser"),tr("Rename contact"),this); connect(m_rename_action,SIGNAL(triggered()),this,SLOT(onRenameAction())); m_delete_action = new QAction(m_plugin_system.getIcon("deleteuser"),tr("Delete contact"),this); connect(m_delete_action,SIGNAL(triggered()),this,SLOT(onDeleteAction())); m_move_action = new QAction(m_plugin_system.getIcon("moveuser"),tr("Move to group"),this); connect(m_move_action,SIGNAL(triggered()),this,SLOT(onMoveAction())); m_subscription_menu = new QMenu(tr("Authorization")); m_subscription_menu->menuAction()->setIcon(m_plugin_system.getIcon("auth")); m_send_subscription_action = new QAction(tr("Send authorization to"),this); m_subscription_menu->addAction(m_send_subscription_action); connect(m_send_subscription_action,SIGNAL(triggered()),this,SLOT(onSendSubscriptionAction())); m_ask_subscription_action = new QAction(tr("Ask authorization from"),this); m_subscription_menu->addAction(m_ask_subscription_action); connect(m_ask_subscription_action,SIGNAL(triggered()),this,SLOT(onAskSubscriptionAction())); m_remove_subscription_action = new QAction(tr("Remove authorization from"),this); m_subscription_menu->addAction(m_remove_subscription_action); connect(m_remove_subscription_action,SIGNAL(triggered()),this,SLOT(onRemoveSubscriptionAction())); m_transports_menu = new QMenu(tr("Transports")); m_register_transport = new QAction(tr("Register"),this); connect(m_register_transport,SIGNAL(triggered()),this,SLOT(onRegisterAction())); m_transports_menu->addAction(m_register_transport); m_unregister_transport = new QAction(tr("Unregister"),this); connect(m_unregister_transport,SIGNAL(triggered()),this,SLOT(onUnregisterAction())); m_transports_menu->addAction(m_unregister_transport); m_transports_menu->addSeparator(); m_login_transport = new QAction(tr("Log In"),this); connect(m_login_transport,SIGNAL(triggered()),this,SLOT(onLogInTransportAction())); m_transports_menu->addAction(m_login_transport); m_logout_transport = new QAction(tr("Log Out"),this); connect(m_logout_transport,SIGNAL(triggered()),this,SLOT(onLogOutTransportAction())); m_transports_menu->addAction(m_logout_transport); m_menu_label = new QLabel; m_menu_label->setAlignment(Qt::AlignCenter); m_menu_title = new QWidgetAction(this); m_menu_title->setDefaultWidget(m_menu_label); }
void MasterView::initContextMenu() { setContextMenuPolicy(Qt::CustomContextMenu); context_menu_ = new QMenu(this); connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showCustomContextMenu(const QPoint&))); QList<QAction*> actions; actions.append(new QAction(tr("Delete"), context_menu_)); connect(actions.back(), SIGNAL(triggered()), this, SLOT(onDeleteAction())); context_menu_->addActions(actions); }
PreferencesDialog::PreferencesDialog(QWidget *parent) : QDialog(parent, Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint), ui(new Ui::PreferencesDialog), mTableWorkingHours(NULL) { ui->setupUi(this); mTableWorkingHours = ui->tableViewWorkingHours; ui->lineEditUserName->setText(Misc::getUserName()); ui->lineEditRealName->setText(TimeTrackingSettings::getInstance()->getPrintingRealName()); ui->checkBoxDisplayImage->setChecked(TimeTrackingSettings::getInstance()->getPrintingShowPicture()); ui->textEditFooter->setText(TimeTrackingSettings::getInstance()->getPrintingFooter()); ui->checkBoxEnableDefaultActions->setCheckState( TimeTrackingSettings::getInstance()->getEnablePeriodDefaultAction() ? Qt::Checked : Qt::Unchecked); ui->timeEditDefaultAction->setTime(TimeTrackingSettings::getInstance()->getPeriodDefaultAction()); connect(ui->timeEditDefaultAction, SIGNAL(timeChanged(QTime)), this, SLOT(onTimeChangedDefaultAction(QTime))); connect(ui->checkBoxEnableDefaultActions, SIGNAL(stateChanged(int)), this, SLOT(onStateChangedDefaultAction(int))); ui->checkBoxRemindPauseTime->setCheckState( TimeTrackingSettings::getInstance()->getEnablePeriodPauseTime() ? Qt::Checked : Qt::Unchecked); ui->timeEditRemindPauseTime->setTime(TimeTrackingSettings::getInstance()->getPeriodPauseTime()); connect(ui->timeEditRemindPauseTime, SIGNAL(timeChanged(QTime)), this, SLOT(onTimeChangedPauseTime(QTime))); connect(ui->checkBoxRemindPauseTime, SIGNAL(stateChanged(int)), this, SLOT(onStateChangedPauseTime(int))); connect(ui->pushButtonAddAction, SIGNAL(clicked()), this, SLOT(onAddAction())); connect(ui->pushButtonDeleteAction, SIGNAL(clicked()), this, SLOT(onDeleteAction())); connect(ui->tableWidgetActions->selectionModel(), SIGNAL(currentChanged(const QModelIndex &,const QModelIndex &)), this, SLOT(onTableActionSelectionChanged(const QModelIndex &, const QModelIndex &))); connect(ui->labelWhatIsThis, SIGNAL(clicked()), this, SLOT(onWhatIsThis())); ui->OKButton->setImagesPath(ClickableImage::mNotSelectedOKButton, ClickableImage::mSelectedOKButtonDefault); connect(ui->OKButton, SIGNAL(clicked()), this, SLOT(onOK())); setAttribute(Qt::WA_TranslucentBackground); init(); }
SkpFileWidget::SkpFileWidget(QWidget *parent) : QWidget(parent), ui(new Ui::SkpFileWidget), m_mouseMoveColor(QColor(193, 210, 240, 50)), m_defaultBackgroundColor(QColor(255, 255, 255)), m_currMouseRow(-1) { ui->setupUi(this); SkpTransferFile::createThread(5); m_signal = new SkpSignal(NULL, 0); m_signalCallback = new SkpSignal(NULL, 0); auto func = std::bind(&SkpFileWidget::registerCallbackChat, this, std::placeholders::_1); m_signal->emit_register_ack(MessageClass_MemoryFile, func); m_signal->emit_register_ack(MessageClass_Chat, func); connect(this, SIGNAL(sigFriendChat(QByteArray)), this, SLOT(onFriendChat(QByteArray))); connect(ui->pushFile_pushButton,SIGNAL(clicked()), this, SLOT(onPushFile())); connect(ui->refresh_pushButton, SIGNAL(clicked()), this, SLOT(onRefresh())); QStringList header; header << tr("name") << tr("md5") << tr("offset") << tr("lenth") << tr("服务器文件状态") << tr("请求状态") << tr("%"); ui->tableWidget->setColumnCount(header.size()); ui->tableWidget->setHorizontalHeaderLabels(header); ui->tableWidget->horizontalHeader()->setStretchLastSection(true); ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); ui->tableWidget->setShowGrid(false); //设置不显示格子线 ui->tableWidget->verticalHeader()->setVisible(false); //设置垂直头不可见 ui->tableWidget->setFrameShape(QFrame::NoFrame); //设置无边框 ui->tableWidget->horizontalHeader()->setHighlightSections(false); ui->tableWidget->setItemDelegate(new NoFocusDelegate()); ui->tableWidget->setMouseTracking(true); ui->tableWidget->horizontalHeader()->setHighlightSections(false); connect(ui->tableWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint))); connect(ui->tableWidget, SIGNAL(cellEntered(int,int)), this, SLOT(onCellEntered(int,int))); connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(onCellClicked(int,int))); header.clear(); header << tr("code") << tr("name") << tr("password"); ui->friend_tableWidget->setColumnCount(header.size()); ui->friend_tableWidget->setHorizontalHeaderLabels(header); ui->friend_tableWidget->horizontalHeader()->setStretchLastSection(true); ui->friend_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->friend_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui->friend_tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); ui->friend_tableWidget->setShowGrid(false); //设置不显示格子线 ui->friend_tableWidget->verticalHeader()->setVisible(false); //设置垂直头不可见 ui->friend_tableWidget->setFrameShape(QFrame::NoFrame); //设置无边框 ui->friend_tableWidget->horizontalHeader()->setHighlightSections(false); ui->friend_tableWidget->setItemDelegate(new NoFocusDelegate()); ui->friend_tableWidget->setMouseTracking(true); ui->friend_tableWidget->horizontalHeader()->setHighlightSections(false); connect(ui->refreshFriend_pushButton, SIGNAL(clicked()), this, SLOT(onRefreshFriend())); connect(this, SIGNAL(sigRefreshFriend(QByteArray)), this, SLOT(onRefreshFriend(QByteArray))); connect(ui->friend_tableWidget, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(onTtemDoubleClicked(QTableWidgetItem*))); m_menu = new QMenu(ui->tableWidget); m_pullAction = new QAction("down", this); connect(m_pullAction, SIGNAL(triggered()), this, SLOT(onPullAction())); m_menu->addAction(m_pullAction); m_startAction = new QAction("start", this); connect(m_startAction, SIGNAL(triggered()), this, SLOT(onStartAction())); m_menu->addAction(m_startAction); m_stopAction = new QAction("stop", this); connect(m_stopAction, SIGNAL(triggered()), this, SLOT(onStopAction())); m_menu->addAction(m_stopAction); m_deleteAction = new QAction("delete", this); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(onDeleteAction())); m_menu->addAction(m_deleteAction); onRefresh(); onRefreshFriend(); }