AlarmTrayIcon::AlarmTrayIcon(QObject *_parent) : QSystemTrayIcon(_parent), //m_kinect(OpenNIObject::instance()), m_contextMenu(new QMenu), m_quitAction(new QAction(tr("&Quit"), this)), m_previewAction(new QAction(tr("&Preview"), this)), m_settingsAction(new QAction(tr("&Settings"), this)), m_startAction(new QAction(tr("S&tart"), this)), m_kinectStarted(false), m_kinectPluginLoader(new KinectPluginLoader(this)) { HardDriveStorage* hds = new HardDriveStorage(this); PicasaStorage* ps = new PicasaStorage(this); ScriptRunner* sr = new ScriptRunner(this); connect(ps, SIGNAL(statusMessage(QString, QString)), SLOT(onMessageSignal(QString, QString))); m_hardDriveStorage = new Storage(m_kinectPluginLoader, hds,this); m_picasaStorage = new Storage(m_kinectPluginLoader, ps, this); m_scriptRunner = new Storage(m_kinectPluginLoader, sr, this); connect(m_kinectPluginLoader, SIGNAL(newKinectEngine(IKinect*)), this, SLOT(onKinectPluginChange(IKinect*))); onKinectPluginChange(m_kinectPluginLoader->plugin()); if (m_kinect) onKinectPluginRunningChange(m_kinect->isRunning()); else onKinectPluginRunningChange(false); connect(m_previewAction, SIGNAL(triggered()), this, SLOT(onDebugAction())); m_contextMenu->addAction(m_previewAction); connect(m_quitAction, SIGNAL(triggered()), this, SLOT(onQuitAction())); connect(m_settingsAction, SIGNAL(triggered()), this, SLOT(onSettingsAction())); connect(m_startAction, SIGNAL(triggered()), this, SLOT(onStartAction())); m_contextMenu->addAction(m_startAction); m_contextMenu->addAction(m_settingsAction); m_contextMenu->addAction(m_quitAction); setContextMenu(m_contextMenu); setToolTip(tr("Kinect Alarm F**k Yea")); QSettings settings; settings.beginGroup("Global"); QVariant var = settings.value("start_after_launch", QVariant(false)); INFO(var.toBool()); if (var.toBool()) { m_startAction->trigger(); } settings.endGroup(); }
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(); }