void CDCTableWidget::onContextMenu(const QPoint& pt) { QMenu menu(this); bool bDlgNoteEditing = G_MainFrame()->isDlgNoteEditing(); // new QAction* pActionNew = menu.addAction(tr("New..."), this, SLOT(onNewNoteItem())); QIcon icon1(QString::fromUtf8(":/res/calendar.png")); pActionNew->setIcon(icon1); // edit QAction* pActionEdit = menu.addAction(tr("Edit..."), this, SLOT(onEditNoteItem())); QIcon icon2(QString::fromUtf8(":/res/edit.png")); pActionEdit->setIcon(icon2); // delete QAction* pActionDelete = menu.addAction(tr("Delete"), this, SLOT(onDeleteNoteItem())); QIcon icon3(QString::fromUtf8(":/res/delete.png")); pActionDelete->setIcon(icon3); pActionEdit->setEnabled(selectionModel()->selectedRows().length()); pActionDelete->setEnabled(selectionModel()->selectedRows().length()); if(bDlgNoteEditing) { pActionNew->setEnabled(false); pActionEdit->setEnabled(false); pActionDelete->setEnabled(false); } menu.exec(QCursor::pos()); }
ParamDialog::ParamDialog(QWidget *parent) : BaseDialog(parent), ui(new Ui::ParamDialog), nDialog(new NumberDialog(this)), param(NULL), name(), treeItem(0), editItem(0), isChanged(false) { ui->setupUi(this); nDialog->move(parent->x()+570, parent->y()+130); connect(nDialog, SIGNAL(outValue()), this, SLOT(nDialogOutValueSLOT())); QIcon icon1(":/param/treeView1.png"); QIcon icon2(":/param/treeView2.png"); treeModel = new QStandardItemModel(ui->paramView); QStandardItem *item1 = new QStandardItem(icon1, QObject::tr("样本过滤设置")); treeModel->appendRow(item1); QStandardItem *item2 = new QStandardItem(icon1, QObject::tr("试剂设置")); treeModel->appendRow(item2); QFont font = item1->font(); font.setPointSize(12); item1->setFont(font); item2->setFont(font); for(int i = 0; i < SystemBase::reagentNum; ++i) { QStandardItem *item = new QStandardItem(icon2, QObject::tr("试剂")+QString::number(i+1)); item2->appendRow(item); } ui->paramView->setModel(treeModel); ui->paramView->expandAll(); QDir dir(SystemBase::path); if(!dir.exists()) dir.mkdir(SystemBase::path); QFile file(SystemBase::path + QString("/") + SystemBase::postfix); if(file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream in(&file); QString str = in.readLine(); QFile f(SystemBase::path + str + QString(".") + SystemBase::postfix); if(f.exists()) { name = str; param = new ParamData(SystemBase::reagentNum, f); goto label; } file.close(); } ui->paramView->setEnabled(false); ui->saveButton->setEnabled(false); ui->saveAsButton->setEnabled(false); label: treeModel->setHorizontalHeaderLabels(QStringList(name)); displayUpdate(); }
ButtonBar::ButtonBar(QWidget *parent) : QWidget(parent) { controller = new ButtonController(); QHBoxLayout *layout = new QHBoxLayout(); runButton = new QPushButton(); runButton->setText("Run"); runButton->setMaximumSize(50, 22); runButton->setMinimumSize(50, 22); QPixmap pix(":/Images/Images/RunButtonIcon.png"); QIcon icon(pix); runButton->setIcon(icon); runButton->setIconSize(pix.size()); buildButton = new QPushButton(); buildButton->setText("Build"); buildButton->setMaximumSize(50, 22); buildButton->setMinimumSize(50, 22); QPixmap pix2(":/Images/Images/BuildButtonIcon.png"); QIcon icon2(pix2); buildButton->setIcon(icon2); buildButton->setIconSize(pix2.size()); connect(runButton, SIGNAL(released()), this, SLOT(runButtonClicked())); connect(buildButton, SIGNAL(released()), this, SLOT(buildButtonClicked())); layout->addWidget(runButton); layout->addWidget(buildButton); layout->setContentsMargins(5, 5, 0, 5); layout->setAlignment(Qt::AlignLeft); setLayout(layout); QPalette Pal(palette()); Pal.setColor(QPalette::Background, "#323232"); setAutoFillBackground(true); setPalette(Pal); //background color for all buttons inside the buttonbar setStyleSheet("QPushButton { color: white; background-color: #2D2D2F; border: none; border-color: black; } QPushButton:hover{ background-color: #1E1E1F; } QPushButton:pressed{ border-left: 2px solid grey; border-top: 2px solid grey; border-right: 2px solid black; border-bottom: 2px solid black; }"); }
middle3::middle3(QWidget *parent) : QWidget(parent) { return_num = '0'; tabWidget = new QTabWidget(); tabWidget->setIconSize(QSize(220,220)); tabWidget->setStyleSheet("QTabBar::tab {height: 40px; width:220px;color: black;font-size:20px;padding: 5px;margin-left:40px;}" "QTabBar::tab:selected { background: lightgray; } "); //新建第一个页面的部件,全盘查杀 widget1 = new QWidget(); QVBoxLayout *mainLayout = new QVBoxLayout(widget1); QHBoxLayout *hLayout4 = new QHBoxLayout(widget1); QLineEdit *tip1 = new QLineEdit("上次查杀时间:"); tip1->setFixedSize(220,60); tip1->setStyleSheet("QLineEdit{font-size : 20px;color:blue;background-color:rgb(255,0,0,0);margin-top:20;margin-left:60;}"); tip1->setFrame(false); tip1->setReadOnly(true); time = new QLineEdit(widget1); time->setStyleSheet("QLineEdit{font-size : 40px;color:black;background-color:rgb(255,0,0,0);background-position:center;background-attachment:fixed;background-image:url(:images/dariay.png);margin-top:20;margin-right:10;}"); time->setFixedSize(240,100); time->setAlignment(Qt::AlignCenter); time->setFrame(false); time->setReadOnly(true); hLayout4->addWidget(tip1); hLayout4->addWidget(time); QHBoxLayout *hLayout = new QHBoxLayout(widget1); QLineEdit *tip = new QLineEdit("全盘查杀比较慢,请耐心等候"); tip->setFixedSize(300,50); tip->setStyleSheet("QLineEdit{font-size : 20px;color:gray;background-color:rgb(255,0,0,0);margin-top:20;margin-right:20;margin-left:20;}"); tip->setFrame(false); tip->setReadOnly(true); QPushButton *kill_pushbutton = new QPushButton("开始查杀"); QPushButton *stop_pushbutton = new QPushButton("停止查杀"); kill_pushbutton->setStyleSheet("QPushButton{color:green;margin-top:20;border: 1px solid green;border-radius:15px;height:30px;margin-left:30px}"); stop_pushbutton->setStyleSheet("QPushButton{color:blue;margin-top:20;border: 1px solid blue;border-radius:15px;height:30px;margin-right:30px}"); hLayout->addWidget(tip); hLayout->addWidget(kill_pushbutton); hLayout->addWidget(stop_pushbutton); QHBoxLayout *hLayout0 = new QHBoxLayout(widget1); QLabel *label3 = new QLabel(widget1); QImage img; img.load(":images/safefile.png"); QImage* imgScaled = new QImage; *imgScaled=img.scaled(100,100,Qt::KeepAspectRatio); label3->setPixmap(QPixmap::fromImage(*imgScaled)); label3->setStyleSheet("QLabel{margin-left:100;}"); safnum = new QLineEdit(widget1); safnum->setStyleSheet("QLineEdit{font-size : 40px;color:black;background-color:rgb(255,0,0,0);margin-left:20;}"); safnum->setFrame(false); safnum->setFixedSize(200,60); safnum->setAlignment(Qt::AlignCenter); safnum->setText("0"); QLineEdit *saffile = new QLineEdit("安全文件 !"); saffile->setStyleSheet("QLineEdit{font-size : 25px;color:blue;background-color:rgb(255,0,0,0);margin-left:20;}"); saffile->setFrame(false); saffile->setReadOnly(true); hLayout0->addWidget(label3); hLayout0->addWidget(safnum); hLayout0->addWidget(saffile); QHBoxLayout *hLayout1 = new QHBoxLayout(widget1); QLabel *label4 = new QLabel(widget1); QImage img2; img2.load(":images/virusfile.png"); QImage* imgScaled2 = new QImage; *imgScaled2=img2.scaled(100, 100,Qt::KeepAspectRatio); label4->setPixmap(QPixmap::fromImage(*imgScaled2)); label4->setStyleSheet("QLabel{margin-left:100;}"); virnum = new QLineEdit(widget1); virnum->setStyleSheet("QLineEdit{font-size : 40px;color:red;background-color:rgb(255,0,0,0);margin-left:20;}"); virnum->setFrame(false); virnum->setFixedSize(200,60); virnum->setAlignment(Qt::AlignCenter); virnum->setText("0"); QLineEdit *virfile = new QLineEdit("危险文件 !"); virfile->setReadOnly(true); virfile->setStyleSheet("QLineEdit{font-size : 25px;color:red;background-color:rgb(255,0,0,0);margin-left:20;}"); virfile->setFrame(false); hLayout1->addWidget(label4); hLayout1->addWidget(virnum); hLayout1->addWidget(virfile); result_label1 = new QTextEdit(widget1); QPalette pl1 = result_label1->palette(); pl1.setBrush(QPalette::Base,QBrush(QColor(255,0,0,0))); result_label1->setPalette(pl1); result_label1->setAlignment(Qt::AlignTop); result_label1->setReadOnly(true); mainLayout->setSpacing(10); mainLayout->addLayout(hLayout4); mainLayout->addLayout(hLayout); mainLayout->addLayout(hLayout0); mainLayout->addLayout(hLayout1); mainLayout->addWidget(result_label1); widget1->setLayout(mainLayout); connect(kill_pushbutton, SIGNAL(clicked()), this, SLOT(all_file())); //新建第二个页面的部件,选择查杀 widget2 = new QWidget(); QHBoxLayout *mainLayout2 = new QHBoxLayout(widget2); mainLayout2->setSpacing(30); QVBoxLayout *vLayout1 = new QVBoxLayout(widget2); vLayout1->setMargin(0); vLayout1->setSpacing(0); QLabel *label = new QLabel(widget2); QPixmap map(":images/file.png"); label->setPixmap(map); vLayout1->addWidget(label); QLabel *label2 = new QLabel(widget2); label2->setText("请输入需要查杀的目录:"); label2->setFixedHeight(25); label2->setAlignment(Qt::AlignCenter); fileline = new QLineEdit(widget2); fileline->setText("/home"); fileline->setStyleSheet("QLineEdit{color:gray;background-color:rgb(255,0,0,0)}"); fileline->setFrame(false); fileline->setFixedSize(150,60); fileline->setTextMargins(20,0,0,0); scan_pushbutton = new QPushButton("浏览..."); scan_pushbutton->setStyleSheet("QPushButton{color:blue;border: 1px solid blue;border-radius:15px;height:30px;margin-left:10px}"); execute_pushbutton = new QPushButton("开始查杀"); execute_pushbutton->setStyleSheet("QPushButton{color:green;border: 1px solid green;border-radius:15px;height:30px;margin-left:10px}"); QFont tip_font2 = label2->font(); tip_font2.setPointSize(14); tip_font2.setItalic(true); tip_font2.setBold(true); label2->setFont(tip_font2); vLayout1->addWidget(label2); QHBoxLayout *hLayout3 = new QHBoxLayout(widget2); hLayout3->addWidget(scan_pushbutton); hLayout3->addWidget(execute_pushbutton); hLayout3->setMargin(30); vLayout1->addWidget(fileline); vLayout1->addLayout(hLayout3); QVBoxLayout *vLayout2 = new QVBoxLayout(widget2); QHBoxLayout *hLayout2 = new QHBoxLayout(widget2); QLabel *label1= new QLabel(widget2); label1->setText("运行结果:"); label1->setAlignment(Qt::AlignLeft); label1->setFixedHeight(25); QFont tip_font = label1->font(); tip_font.setPointSize(14); tip_font.setBold(true); label1->setFont(tip_font); hLayout2->addWidget(label1); hLayout2->setSpacing(0); hLayout2->setMargin(30); result_label = new QTextEdit(widget2); QPalette pl = result_label->palette(); pl.setBrush(QPalette::Base,QBrush(QColor(255,0,0,0))); result_label->setPalette(pl); result_label->setAlignment(Qt::AlignTop); result_label->setReadOnly(true); vLayout2->setMargin(0); vLayout2->setSpacing(0); vLayout2->addLayout(hLayout2); vLayout2->addWidget(result_label); mainLayout2->addLayout(vLayout1); mainLayout2->addLayout(vLayout2); widget2->setLayout(mainLayout2); QIcon icon1(":images/full_scan.png"); tabWidget->addTab(widget1,icon1,""); QIcon icon2(":images/custom_scan.png"); tabWidget->addTab(widget2, icon2,""); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(tabWidget); this->setLayout(layout); connect(scan_pushbutton, SIGNAL(clicked()), this, SLOT(show_file())); connect(execute_pushbutton, SIGNAL(clicked()), this, SLOT(scan_file())); connect(stop_pushbutton, SIGNAL(clicked()), this, SLOT(kill_process())); connect(fileline, SIGNAL(textChanged(QString)), this, SLOT(get_file())); temp = 0; flag = 0; myThread = new QProcess; myThread1 = new QProcess; //定时器,实时刷新 timer = new QTimer(this); QWidget::connect( timer, SIGNAL( timeout() ), this, SLOT( timer_update_currentTabInfo() ) ); timer->start(0075); }
middle6::middle6(QWidget *parent) : QDialog(parent) { tabWidget = new QTabWidget(); tabWidget->setStyleSheet("QTabBar::tab {height: 50px; width:220px;background-image:url(:/3);color: black;font-size:25px;font-family:宋体;padding: 0px;margin-left:40px;}" "QTabBar::tab:selected { background: lightgray; } "); //新建第一个页面的部件 QWidget *widget = new QWidget(); QVBoxLayout *mainLayout = new QVBoxLayout(); QHBoxLayout *hLayout = new QHBoxLayout(); listWidget = new QListWidget(); listWidget->setStyleSheet("border:0px;"); pushButton_processfresh = new QPushButton("刷新"); pushButton_processfresh->setStyleSheet("QPushButton{color:blue;border: 1px solid blue;border-radius:15px;height:30px;margin-left:10px;margin-top:10px;}"); pushButton_processkill = new QPushButton("关闭"); pushButton_processkill->setStyleSheet("QPushButton{color:green;border: 1px solid green;border-radius:15px;height:30px;margin-left:10px;margin-top:10px;}"); mainLayout->addWidget(listWidget); hLayout->addWidget(pushButton_processfresh); hLayout->addWidget(pushButton_processkill); mainLayout->addLayout(hLayout); widget->setLayout(mainLayout); //新建第二个页面的部件 QWidget *widget2 = new QWidget(); QVBoxLayout *mainLayout2 = new QVBoxLayout(widget2); // QLabel *label = new QLabel(""); QHBoxLayout *hLayout2 = new QHBoxLayout(widget2); QPushButton *pushButton_task = new QPushButton("进程信息"); pushButton_task->setStyleSheet("QPushButton{color:blue;border: 1px solid blue;border-radius:5px;height:20px;}"); QPushButton *pushButton_state= new QPushButton("运行状态"); pushButton_state->setStyleSheet("QPushButton{color:blue;border: 1px solid blue;border-radius:5px;height:20px;}"); hLayout2->addWidget(pushButton_task); hLayout2->addWidget(pushButton_state); listWidget2 = new QListWidget(widget2); listWidget2->setSpacing(5); listWidget2->setStyleSheet("QListWidget{background-color:#FFF0F5;border:0px;}"); // listWidget2->addItem(topItem); listWidget2->setStyleSheet("border:0px;"); listWidget2->setIconSize(QSize(48,48)); pushButton_processkill2 = new QPushButton("关闭"); pushButton_processkill2->setStyleSheet("QPushButton{color:green;border: 1px solid green;border-radius:15px;height:30px;margin-left:10px;margin-top:10px;}"); mainLayout2->addLayout(hLayout2); mainLayout2->addWidget(listWidget2); mainLayout2->addWidget(pushButton_processkill2); widget2->setLayout(mainLayout2); //向QTabWidget中添加第一个页面 QIcon icon1(":/new/icon/images/1.ico"); tabWidget->addTab(widget2, icon1, "应用进程"); //向QTabWidget中添加第二个页面 QIcon icon2(":/new/icon/images/2.ico"); tabWidget->addTab(widget, icon2, "所有进程"); QHBoxLayout *layout = new QHBoxLayout(); layout->addWidget(tabWidget); this->setLayout(layout); //创建进程执行shell脚本 thread1 = new QProcess; thread2 = new QProcess; thread3 = new QProcess; thread4 = new QProcess; thread5 = new QProcess; thread6 = new QProcess; thread7 = new QProcess; thread8 = new QProcess; thread9 = new QProcess; flag1 = flag2 = flag3 = flag4 = flag5 = flag6 = flag7 = flag8 = flag9 = 0; timer = new QTimer(this); QWidget::connect( timer, SIGNAL( timeout() ), this, SLOT( timer_update_currentTabInfo() ) ); QWidget::connect( tabWidget, SIGNAL( currentChanged(int)), this, SLOT( on_tabWidget_INFO_currentChanged(int)) ); timer->start(1000); }
void frmMDFEditor::CreateControls() { frmMDFEditor* itemFrame = this; wxMenuBar* menuBar = new wxMenuBar; wxMenu* itemMenu3 = new wxMenu; itemMenu3->Append( ID_MENUITEM_NEW, _( "Create New MDF File" ), wxEmptyString, wxITEM_NORMAL ); itemMenu3->AppendSeparator(); itemMenu3->Append( ID_MENUITEM_OPEN, _( "Open MDF file..." ), wxEmptyString, wxITEM_NORMAL ); itemMenu3->Append( ID_MENUITEM_SAVE, _( "Save MDF File..." ), wxEmptyString, wxITEM_NORMAL ); itemMenu3->AppendSeparator(); itemMenu3->Append( ID_MENUITEM_DOWNLOAD, _( "Download MDF file..." ), wxEmptyString, wxITEM_NORMAL ); itemMenu3->Append( ID_MENUITEM_UPLOAD, _( "Upload MDF file..." ), wxEmptyString, wxITEM_NORMAL ); itemMenu3->AppendSeparator(); itemMenu3->Append( ID_MENUITEM_EXIT, _( "Exit" ), wxEmptyString, wxITEM_NORMAL ); menuBar->Append( itemMenu3, _( "File" ) ); wxMenu* itemMenu13 = new wxMenu; itemMenu13->Append( ID_MENUITEM_ADD, _( "Add MDF Item..." ), wxEmptyString, wxITEM_NORMAL ); itemMenu13->Append( ID_MENUITEM_REMOVE, _( "Remove MDF Item..." ), wxEmptyString, wxITEM_NORMAL ); menuBar->Append( itemMenu13, _( "Edit" ) ); itemFrame->SetMenuBar( menuBar ); wxPanel* itemPanel = new wxPanel; itemPanel->Create( itemFrame, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL ); wxBoxSizer* itemBoxSizer = new wxBoxSizer( wxVERTICAL ); itemPanel->SetSizer( itemBoxSizer ); wxToolBar* itemToolBar = new wxToolBar; itemToolBar->Create( itemPanel, ID_TOOLBAR3, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_HORIZONTAL ); wxBitmap itemtool19Bitmap( itemFrame->GetBitmapResource( wxT( "deffile.xpm" ) ) ); wxBitmap itemtool19BitmapDisabled; itemToolBar->AddTool( ID_TOOL_NEW, wxEmptyString, itemtool19Bitmap, itemtool19BitmapDisabled, wxITEM_NORMAL, _( "Create new MDF file" ), wxEmptyString ); wxBitmap itemtool20Bitmap( itemFrame->GetBitmapResource( wxT( "open.xpm" ) ) ); wxBitmap itemtool20BitmapDisabled; itemToolBar->AddTool( ID_TOOL_LOAD, wxEmptyString, itemtool20Bitmap, itemtool20BitmapDisabled, wxITEM_NORMAL, _( "Load MDF file" ), wxEmptyString ); wxBitmap itemtool21Bitmap( itemFrame->GetBitmapResource( wxT( "save.xpm" ) ) ); wxBitmap itemtool21BitmapDisabled; itemToolBar->AddTool( ID_TOOL_SAVE, wxEmptyString, itemtool21Bitmap, itemtool21BitmapDisabled, wxITEM_NORMAL, _( "Save MDF file" ), wxEmptyString ); wxBitmap itemtool22Bitmap( itemFrame->GetBitmapResource( wxT( "filesaveas.xpm" ) ) ); wxBitmap itemtool22BitmapDisabled; itemToolBar->AddTool( ID_TOOL_UPLOAD, wxEmptyString, itemtool22Bitmap, itemtool22BitmapDisabled, wxITEM_NORMAL, _( "Upload MDF file" ), wxEmptyString ); wxBitmap itemtool23Bitmap( itemFrame->GetBitmapResource( wxT( "redo.xpm" ) ) ); wxBitmap itemtool23BitmapDisabled; itemToolBar->AddTool( ID_TOOL_DOWNLOAD, wxEmptyString, itemtool23Bitmap, itemtool23BitmapDisabled, wxITEM_NORMAL, _( "Upload MDF file" ), wxEmptyString ); itemToolBar->AddSeparator(); wxBitmap itemtool25Bitmap( itemFrame->GetBitmapResource( wxT( "New1.xpm" ) ) ); wxBitmap itemtool25BitmapDisabled; itemToolBar->AddTool( ID_TOOL_ADD_ITEM, wxEmptyString, itemtool25Bitmap, itemtool25BitmapDisabled, wxITEM_NORMAL, _( "Add MDF item" ), wxEmptyString ); wxBitmap itemtool26Bitmap( itemFrame->GetBitmapResource( wxT( "delete.xpm" ) ) ); wxBitmap itemtool26BitmapDisabled; itemToolBar->AddTool( ID_TOOL_REMOVE_ITEM, wxEmptyString, itemtool26Bitmap, itemtool26BitmapDisabled, wxITEM_NORMAL, _( "Remove MDF item" ), wxEmptyString ); itemToolBar->Realize(); itemBoxSizer->Add( itemToolBar, 0, wxGROW | wxALL, 5 ); m_mdfTree = new wxTreeCtrl; m_mdfTree->Create( itemPanel, ID_TREECTRL, wxDefaultPosition, wxSize( 400, 300 ), wxTR_HAS_BUTTONS | wxTR_FULL_ROW_HIGHLIGHT | wxTR_LINES_AT_ROOT | wxTR_ROW_LINES | wxTR_SINGLE ); itemBoxSizer->Add( m_mdfTree, 0, wxGROW | wxALL, 2 ); m_htmlInfoWnd = new wxHtmlWindow; m_htmlInfoWnd->Create( itemPanel, ID_HTMLWINDOW2, wxDefaultPosition, wxSize( 200, 150 ), wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER | wxHSCROLL | wxVSCROLL ); m_htmlInfoWnd->SetPage( _( "<html><h4>No data</h4></html>" ) ); itemBoxSizer->Add( m_htmlInfoWnd, 0, wxGROW | wxALL, 5 ); // Connect events and objects m_mdfTree->Connect( ID_TREECTRL, wxEVT_LEFT_DOWN, wxMouseEventHandler( frmMDFEditor::OnLeftDown ), NULL, this ); m_mdfTree->Connect( ID_TREECTRL, wxEVT_LEFT_DCLICK, wxMouseEventHandler( frmMDFEditor::OnLeftDClick ), NULL, this ); wxImageList* itemImageList = new wxImageList( 16, 16, true, 5 ); { wxImage icon0( Home_xpm ); icon0.Rescale( 16, 16 ); itemImageList->Add( icon0 ); wxImage icon1( Folder_Add_xpm ); icon1.Rescale( 16, 16 ); itemImageList->Add( icon1 ); wxImage icon2( Info_xpm ); icon2.Rescale( 16, 16 ); itemImageList->Add( icon2 ); wxImage icon3( copy_xpm ); icon3.Rescale( 16, 16 ); itemImageList->Add( icon3 ); wxImage icon4( copy_xpm ); icon4.Rescale( 16, 16 ); itemImageList->Add( icon4 ); } m_mdfTree->AssignImageList( itemImageList ); addDefaultContent(); }