📄 mainform.cpp
字号:
/****************************************************************************** Form implementation generated from reading ui file 'mainform.ui'**** Created by: The User Interface Compiler ($Id: qt/main.cpp 3.3.6 edited Aug 31 2005 $)**** WARNING! All changes made in this file will be lost!****************************************************************************/#include "mainform.h"#include <qvariant.h>#include <qpushbutton.h>#include <qtabwidget.h>#include <qwidget.h>#include <qheader.h>#include <qlistview.h>#include <qlabel.h>#include <qsplitter.h>#include <qprogressbar.h>#include <qlayout.h>#include <qtooltip.h>#include <qwhatsthis.h>#include <qaction.h>#include <qmenubar.h>#include <qpopupmenu.h>#include <qtoolbar.h>#include <qimage.h>#include <qpixmap.h>#include <sstream>#include <vector>#include <bitset>using namespace std;#include "qapplication.h"#include "about.h"#include "qmessagebox.h"#include "qtabwidget.h"#include "qlistview.h"#include "qpainter.h"#include "qpen.h"#include "qbrush.h"#include "qprogressbar.h"#include "openfiles.h"#include "qlineedit.h"#include "detailform.h"#include "childprocessform.h"#include "signalform.h"#include "mainform.ui.h"#include "ProcItem.h"#define NUM 256/* * Constructs a MainForm as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * */MainForm::MainForm( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ){ (void)statusBar(); if ( !name ) setName( "MainForm" ); setCentralWidget( new QWidget( this, "qt_central_widget" ) ); MainFormLayout = new QGridLayout( centralWidget(), 1, 1, 11, 6, "MainFormLayout"); spacer1 = new QSpacerItem( 20, 453, QSizePolicy::Minimum, QSizePolicy::Expanding ); MainFormLayout->addMultiCell( spacer1, 0, 1, 1, 1 ); spacer5 = new QSpacerItem( 622, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); MainFormLayout->addItem( spacer5, 1, 0 ); tabWidget = new QTabWidget( centralWidget(), "tabWidget" ); tab = new QWidget( tabWidget, "tab" ); tabLayout = new QGridLayout( tab, 1, 1, 11, 6, "tabLayout"); spacer8 = new QSpacerItem( 310, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); tabLayout->addItem( spacer8, 1, 0 ); endProcess = new QPushButton( tab, "endProcess" ); tabLayout->addWidget( endProcess, 1, 1 ); listView1 = new QListView( tab, "listView1" ); listView1->addColumn( tr( "ID" ) ); listView1->addColumn( trUtf8( "\xe8\xbf\x9b\xe7\xa8\x8b\xe5\x90\x8d\x20\x20\x20\x20" ) ); listView1->addColumn( trUtf8( "\xe7\x8a\xb6\xe6\x80\x81" ) ); listView1->addColumn( trUtf8( "\xe9\xa9\xbb\xe7\x95\x99\xe5\x86\x85\xe5\xad\x98" ) ); listView1->addColumn( trUtf8( "\xe8\x99\x9a\xe6\x8b\x9f\xe5\x86\x85\xe5\xad\x98" ) ); listView1->addColumn( tr( "Nice" ) ); listView1->setFrameShape( QListView::PopupPanel ); listView1->setFrameShadow( QListView::Raised ); listView1->setSelectionMode( QListView::Single ); listView1->setAllColumnsShowFocus( TRUE ); listView1->setShowSortIndicator( FALSE ); listView1->setItemMargin( 0 ); listView1->setSorting(-1,false); tabLayout->addMultiCellWidget( listView1, 0, 0, 0, 1 ); spacer6 = new QSpacerItem( 20, 310, QSizePolicy::Minimum, QSizePolicy::Expanding ); tabLayout->addMultiCell( spacer6, 0, 1, 2, 2 ); tabWidget->insertTab( tab, QString::fromLatin1("") ); TabPage = new QWidget( tabWidget, "TabPage" ); TabPageLayout = new QGridLayout( TabPage, 1, 1, 11, 6, "TabPageLayout"); spacer28 = new QSpacerItem( 20, 50, QSizePolicy::Minimum, QSizePolicy::Expanding ); TabPageLayout->addItem( spacer28, 1, 0 ); layout26 = new QHBoxLayout( 0, 0, 6, "layout26"); layout23 = new QHBoxLayout( 0, 0, 6, "layout23"); textLabel12 = new QLabel( TabPage, "textLabel12" ); layout23->addWidget( textLabel12 ); usedMemorytextLabel = new QLabel( TabPage, "usedMemorytextLabel" ); layout23->addWidget( usedMemorytextLabel ); textLabel14 = new QLabel( TabPage, "textLabel14" ); layout23->addWidget( textLabel14 ); layout26->addLayout( layout23 ); layout24 = new QHBoxLayout( 0, 0, 6, "layout24"); textLabel15 = new QLabel( TabPage, "textLabel15" ); layout24->addWidget( textLabel15 ); totalMemory = new QLabel( TabPage, "totalMemory" ); layout24->addWidget( totalMemory ); textLabel17 = new QLabel( TabPage, "textLabel17" ); layout24->addWidget( textLabel17 ); layout26->addLayout( layout24 ); TabPageLayout->addLayout( layout26, 3, 0 ); splitter4 = new QSplitter( TabPage, "splitter4" ); splitter4->setOrientation( QSplitter::Vertical ); textLabel1 = new QLabel( splitter4, "textLabel1" ); CPUprogressBar = new QProgressBar( splitter4, "CPUprogressBar" ); CPUprogressBar->setPaletteForegroundColor( QColor( 0, 0, 0 ) ); CPUprogressBar->setPaletteBackgroundColor( QColor( 85, 170, 255 ) ); CPUprogressBar->setBackgroundOrigin( QProgressBar::WidgetOrigin ); CPUprogressBar->setCursor( QCursor( 13 ) ); CPUprogressBar->setFrameShape( QProgressBar::NoFrame ); CPUprogressBar->setMargin( 5 ); TabPageLayout->addWidget( splitter4, 0, 0 ); splitter5 = new QSplitter( TabPage, "splitter5" ); splitter5->setOrientation( QSplitter::Vertical ); textLabel2 = new QLabel( splitter5, "textLabel2" ); MemoryprogressBar = new QProgressBar( splitter5, "MemoryprogressBar" ); MemoryprogressBar->setPaletteBackgroundColor( QColor( 27, 139, 14 ) ); MemoryprogressBar->setCursor( QCursor( 13 ) ); MemoryprogressBar->setFrameShape( QProgressBar::NoFrame ); MemoryprogressBar->setMargin( 5 ); TabPageLayout->addWidget( splitter5, 2, 0 ); tabWidget->insertTab( TabPage, QString::fromLatin1("") ); MainFormLayout->addWidget( tabWidget, 0, 0 ); // actions fileSaveAsAction = new QAction( this, "fileSaveAsAction" ); fileExitAction = new QAction( this, "fileExitAction" ); AboutAction = new QAction( this, "AboutAction" ); AboutAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) ); refreshAction = new QAction( this, "refreshAction" ); refreshspeedActionGroup = new QActionGroup( this, "refreshspeedActionGroup" ); refreshspeedActionGroup->setUsesDropDown( FALSE ); HighAction = new QAction( refreshspeedActionGroup, "HighAction" ); HighAction->setToggleAction( TRUE ); LowAction = new QAction( refreshspeedActionGroup, "LowAction" ); LowAction->setToggleAction( TRUE ); StandardAction = new QAction( refreshspeedActionGroup, "StandardAction" ); StandardAction->setToggleAction( TRUE ); StandardAction->setOn( FALSE ); PauseAction = new QAction( refreshspeedActionGroup, "PauseAction" ); PauseAction->setToggleAction( TRUE ); ActionGroup = new QActionGroup( this, "ActionGroup" ); ActionGroup->setUsesDropDown( TRUE ); SpeedAction = new QAction( this, "SpeedAction" ); separatorAction = new QAction( this, "separatorAction" ); stopProcessAction = new QAction( this, "stopProcessAction" ); continueProcessCAction = new QAction( this, "continueProcessCAction" ); endProcessAction = new QAction( this, "endProcessAction" ); killProcessKAction = new QAction( this, "killProcessKAction" ); openFileAction = new QAction( this, "openFileAction" ); enew_itemAction = new QAction( this, "enew_itemAction" ); detailAction = new QAction( this, "detailAction" ); Action_2 = new QAction( this, "Action_2" ); signalAction = new QAction( this, "signalAction" ); childProcessAction = new QAction( this, "childProcessAction" ); Action = new QAction( this, "Action" ); // toolbars // menubar MenuBar = new QMenuBar( this, "MenuBar" ); F = new QPopupMenu( this ); fileExitAction->addTo( F ); MenuBar->insertItem( QString(""), F, 1 ); E = new QPopupMenu( this ); killProcessKAction->addTo( E ); endProcessAction->addTo( E ); E->insertSeparator(); stopProcessAction->addTo( E ); continueProcessCAction->addTo( E ); MenuBar->insertItem( QString(""), E, 2 ); V = new QPopupMenu( this ); refreshAction->addTo( V ); popupMenu_8 = new QPopupMenu( this ); V->insertItem( SpeedAction->iconSet(), trUtf8( "\xe6\x9b\xb4\xe6\x96\xb0\xe9\x80\x9f\xe5\xba\xa6\x28\x26\x53\x29\x20" ), popupMenu_8 ); HighAction->addTo( popupMenu_8 ); StandardAction->addTo( popupMenu_8 ); LowAction->addTo( popupMenu_8 ); PauseAction->addTo( popupMenu_8 ); V->insertSeparator(); openFileAction->addTo( V ); V->insertSeparator(); detailAction->addTo( V ); signalAction->addTo( V ); childProcessAction->addTo( V ); MenuBar->insertItem( QString(""), V, 3 ); H = new QPopupMenu( this ); AboutAction->addTo( H ); MenuBar->insertItem( QString(""), H, 4 ); MenuBar->insertSeparator( 5 ); languageChange(); resize( QSize(670, 522).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); // signals and slots connections connect( fileExitAction, SIGNAL( activated() ), this, SLOT( FileExit() ) ); connect( AboutAction, SIGNAL( activated() ), this, SLOT( ShowAbout() ) ); connect( refreshspeedActionGroup, SIGNAL( selected(QAction*) ), this, SLOT( changeSpeed(QAction*) ) ); connect( endProcess, SIGNAL( clicked() ), this, SLOT( EndProcess() ) ); connect( stopProcessAction, SIGNAL( activated() ), this, SLOT( stopProcess() ) ); connect( continueProcessCAction, SIGNAL( activated() ), this, SLOT( continueProcess() ) ); connect( endProcessAction, SIGNAL( activated() ), this, SLOT( EndProcess() ) ); connect( killProcessKAction, SIGNAL( activated() ), this, SLOT( killProcess() ) ); connect( openFileAction, SIGNAL( activated() ), this, SLOT( openFile() ) ); connect( refreshAction, SIGNAL( activated() ), this, SLOT( refreshAtonce() ) ); connect( detailAction, SIGNAL( activated() ), this, SLOT( detailInfo() ) ); connect( childProcessAction, SIGNAL( activated() ), this, SLOT( childprocessInfo() ) ); connect( signalAction, SIGNAL( activated() ), this, SLOT( signalInfo() ) ); connect( tabWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( tabWidgetcurrentChange() ) ); init();}/* * Destroys the object and frees any allocated resources */MainForm::~MainForm(){ destroy(); // no need to delete child widgets, Qt does it all for us}/* * Sets the strings of the subwidgets using the current * language. */void MainForm::languageChange(){ setCaption( trUtf8( "\x20\xe8\xbf\x9b\xe7\xa8\x8b\xe7\xae\xa1\xe7\x90\x86\xe5\x99\xa8\x20" ) ); endProcess->setText( trUtf8( "\xe7\xbb\x93\xe6\x9d\x9f\xe8\xbf\x9b\xe7\xa8\x8b\x28\x26\x45\x29" ) ); endProcess->setAccel( QKeySequence( tr( "Alt+E" ) ) ); listView1->header()->setLabel( 0, tr( "ID" ) ); listView1->header()->setLabel( 1, trUtf8( "\xe8\xbf\x9b\xe7\xa8\x8b\xe5\x90\x8d\x20\x20\x20\x20" ) ); listView1->header()->setLabel( 2, trUtf8( "\xe7\x8a\xb6\xe6\x80\x81" ) ); listView1->header()->setLabel( 3, trUtf8( "\xe9\xa9\xbb\xe7\x95\x99\xe5\x86\x85\xe5\xad\x98" ) ); listView1->header()->setLabel( 4, trUtf8( "\xe8\x99\x9a\xe6\x8b\x9f\xe5\x86\x85\xe5\xad\x98" ) ); listView1->header()->setLabel( 5, tr( "Nice" ) ); listView1->clear(); QListViewItem * item = new QListViewItem( listView1, 0 ); item->setText( 0, trUtf8( "\xe8\xbf\x9b\xe7\xa8\x8b\xe5\x90\x8d\x20" ) ); tabWidget->changeTab( tab, trUtf8( "\xe8\xbf\x9b\xe7\xa8\x8b\x20\x20" ) ); textLabel12->setText( trUtf8( "\xe5\xb7\xb2\xe4\xbd\xbf\xe7\x94\xa8\xe5\x86\x85\xe5\xad\x98\xef\xbc\x9a" ) ); usedMemorytextLabel->setText( tr( "123123" ) ); textLabel14->setText( tr( "MB" ) ); textLabel15->setText( trUtf8( "\xe6\x80\xbb\xe5\x85\xb1\xe5\x86\x85\xe5\xad\x98\xef\xbc\x9a" ) ); totalMemory->setText( tr( "234567" ) ); textLabel17->setText( tr( "MB" ) ); textLabel1->setText( trUtf8( "\x43\x50\x55\x20\xe7\x8a\xb6\xe6\x80\x81" ) ); QToolTip::add( CPUprogressBar, trUtf8( "\x43\x50\x55\xe7\x8a\xb6\xe6\x80\x81\x20" ) ); textLabel2->setText( trUtf8( "\xe5\x86\x85\xe5\xad\x98\xe4\xbd\xbf\xe7\x94\xa8\xe6\x83\x85\xe5\x86\xb5" ) ); QToolTip::add( MemoryprogressBar, trUtf8( "\xe5\x86\x85\xe5\xad\x98\xe4\xbd\xbf\xe7\x94\xa8\xe6\x83\x85\xe5\x86\xb5" ) ); tabWidget->changeTab( TabPage, trUtf8( "\xe6\x80\xa7\xe8\x83\xbd\x20\x20" ) ); fileSaveAsAction->setText( tr( "Save As" ) ); fileSaveAsAction->setMenuText( tr( "Save &As..." ) ); fileSaveAsAction->setAccel( QString::null ); fileExitAction->setText( trUtf8( "\xe9\x80\x80\xe5\x87\xba\x28\x26\x51\x29" ) ); fileExitAction->setMenuText( trUtf8( "\xe9\x80\x80\xe5\x87\xba\x28\x26\x51\x29" ) ); fileExitAction->setAccel( tr( "Ctrl+Q" ) ); AboutAction->setText( trUtf8( "\xe5\x85\xb3\xe4\xba\x8e\x28\x26\x41\x29" ) ); AboutAction->setMenuText( trUtf8( "\xe5\x85\xb3\xe4\xba\x8e\x28\x26\x41\x29" ) ); AboutAction->setAccel( tr( "Ctrl+A" ) ); refreshAction->setText( tr( "refresh" ) ); refreshAction->setMenuText( trUtf8( "\xe7\xab\x8b\xe5\x8d\xb3\xe6\x9b\xb4\xe6\x96\xb0\x28\x26\x52\x29" ) ); refreshAction->setAccel( tr( "Ctrl+R" ) ); refreshspeedActionGroup->setText( tr( "ActionGroup" ) ); HighAction->setText( tr( "High" ) ); HighAction->setMenuText( trUtf8( "\xe9\xab\x98\x28\x26\x48\x29" ) ); HighAction->setToolTip( trUtf8( "\xe9\xab\x98\x20" ) ); HighAction->setAccel( tr( "Ctrl+H" ) ); LowAction->setText( tr( "Low" ) ); LowAction->setMenuText( trUtf8( "\xe4\xbd\x8e\x20\x28\x26\x4c\x29" ) ); LowAction->setToolTip( trUtf8( "\xe4\xbd\x8e" ) ); LowAction->setAccel( tr( "Ctrl+L" ) ); StandardAction->setText( tr( "Action" ) ); StandardAction->setMenuText( trUtf8( "\xe6\xa0\x87\xe5\x87\x86\x28\x26\x4e\x29" ) ); StandardAction->setToolTip( trUtf8( "\xe6\xa0\x87\xe5\x87\x86" ) ); StandardAction->setAccel( tr( "Ctrl+N" ) ); PauseAction->setText( tr( "Pause" ) ); PauseAction->setMenuText( trUtf8( "\xe6\x9a\x82\xe5\x81\x9c\x28\x26\x50\x29" ) ); PauseAction->setToolTip( trUtf8( "\xe6\x9a\x82\xe5\x81\x9c" ) ); PauseAction->setAccel( tr( "Ctrl+P" ) ); ActionGroup->setText( tr( "ActionGroup" ) ); SpeedAction->setText( trUtf8( "\xe6\x9b\xb4\xe6\x96\xb0\xe9\x80\x9f\xe5\xba\xa6\x28\x26\x53\x29\x20" ) ); SpeedAction->setMenuText( trUtf8( "\xe6\x9b\xb4\xe6\x96\xb0\xe9\x80\x9f\xe5\xba\xa6\x28\x26\x53\x29\x20" ) ); separatorAction->setText( QString::null ); separatorAction->setMenuText( QString::null ); stopProcessAction->setText( trUtf8( "\xe6\x9a\x82\xe5\x81\x9c\xe8\xbf\x9b\xe7\xa8\x8b\x28\x26\x53\x29" ) ); stopProcessAction->setMenuText( trUtf8( "\xe6\x9a\x82\xe5\x81\x9c\xe8\xbf\x9b\xe7\xa8\x8b\x28\x26\x53\x29" ) ); stopProcessAction->setAccel( tr( "Ctrl+S" ) ); continueProcessCAction->setText( trUtf8( "\xe7\xbb\xa7\xe7\xbb\xad\xe8\xbf\x9b\xe7\xa8\x8b\x28\x26\x43\x29" ) ); continueProcessCAction->setMenuText( trUtf8( "\xe7\xbb\xa7\xe7\xbb\xad\xe8\xbf\x9b\xe7\xa8\x8b\x28\x26\x43\x29" ) ); continueProcessCAction->setAccel( tr( "Ctrl+C" ) ); endProcessAction->setText( trUtf8( "\xe7\xbb\x88\xe6\xad\xa2\xe8\xbf\x9b\xe7\xa8\x8b\x28\x26\x50\x29" ) ); endProcessAction->setMenuText( trUtf8( "\xe7\xbb\x88\xe6\xad\xa2\xe8\xbf\x9b\xe7\xa8\x8b\x28\x26\x50\x29" ) ); endProcessAction->setAccel( tr( "Ctrl+P" ) ); killProcessKAction->setText( trUtf8( "\xe6\x8c\x82\xe8\xb5\xb7\xe8\xbf\x9b\xe7\xa8\x8b\x28\x26\x48\x29" ) ); killProcessKAction->setMenuText( trUtf8( "\xe6\x8c\x82\xe8\xb5\xb7\xe8\xbf\x9b\xe7\xa8\x8b\x28\x26\x48\x29" ) ); killProcessKAction->setAccel( tr( "Ctrl+H" ) ); openFileAction->setText( trUtf8( "\xe6\x89\x93\xe5\xbc\x80\xe7\x9a\x84\xe6\x96\x87\xe4\xbb\xb6\x28\x26\x46\x29" ) );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -