// // QPerforce is a gui interface to the perforce revision control // system. It is based on the qt library, and should be easily portable // across any platform that has this toolkit available. // // Copyright (C) 2002 Jacob Gladish // // TODO: find legit copyright. // #include "qperforcewindow.h" #include "BranchSpecMenu.h" #include "ChangeListMenu.h" #include "Client.h" #include "ClientSpecMenu.h" #include "ConfigOptions.h" #include "DepotTree.h" #include "EditMenu.h" #include "FileMenu.h" #include "HelpMenu.h" #include "ImageManager.h" #include "JobMenu.h" #include "LabelMenu.h" #include "SettingsMenu.h" #include "StatusPane.h" #include "Change.h" #include "ToolsMenu.h" #include "UserMenu.h" #include "ViewMenu.h" #include <qfont.h> #include <qlabel.h> #include <qlineedit.h> #include <qmenubar.h> #include <qscrollbar.h> #include <qsplitter.h> #include <qstatusbar.h> #include <qtoolbar.h> #include <qtoolbutton.h> #include <qvbox.h> #include <qwidgetstack.h> const char* _widget_names [] = { "Perforce Users", "Submitted Perforce Changelists", "Perforce Branches", "Perforce Jobs", "Perforce Labels", "Perforce Clients", "Pending Perforce Changelists", "You Screwed Up" }; qperforceWindow* qperforceWindow::_instance = NULL; qperforceWindow* qperforceWindow::getInstance() { if (_instance == NULL) { _instance = new qperforceWindow(); } return _instance; } qperforceWindow::qperforceWindow( QWidget* parent, const char* name, WFlags f ) : QMainWindow( parent, name, f ) { setCaption( "qperforce" ); resize( QSize(800,600) ); buildMenuBar(); buildToolBar(); _verticalSplitter = new QSplitter( Qt::Vertical, this ); _topHorizontalSplitter = new QSplitter( Qt::Horizontal, _verticalSplitter ); _statusPane = new StatusPane( _verticalSplitter ); //====================================================================== // setup the left and right panes with the proper layouts for the // titles // // left box QFont titleFont( "Sans Serif", 10, QFont::Bold, false, QFont::ISO_8859_1 ); QVBox* leftBox = new QVBox( _topHorizontalSplitter ); _leftPaneTitle = new QLineEdit( leftBox ); _leftPaneTitle->setReadOnly( true ); _leftPaneTitle->setFont( titleFont ); _leftPaneTitle->setText( "Client View of Depot" ); // QLabel* left = new QLabel( "Top Left", leftBox ); _depotTree = new DepotTree( leftBox ); // // right box // QVBox* rightBox = new QVBox( _topHorizontalSplitter ); _rightPaneTitle = new QLineEdit( rightBox ); _rightPaneTitle->setReadOnly( true ); _rightPaneTitle->setFont( titleFont ); _rightWidgetStack = new QWidgetStack( rightBox ); buildRightWidgetStack(); // // end layout //====================================================================== //====================================================================== // setup signals/slots // QObject::connect( _userMenu, SIGNAL(showUsers(WidgetId)), this, SLOT(showWidget(WidgetId)) ); QObject::connect( _changelistMenu, SIGNAL(showSubmittedChangeLists(WidgetId)), this, SLOT(showWidget(WidgetId)) ); QObject::connect( _branchSpecMenu, SIGNAL(showBranchSpecs(WidgetId)), this, SLOT(showWidget(WidgetId)) ); QObject::connect( _jobMenu, SIGNAL(showJobs(WidgetId)), this, SLOT(showWidget(WidgetId)) ); QObject::connect( _labelMenu, SIGNAL(showLabels(WidgetId)), this, SLOT(showWidget(WidgetId)) ); QObject::connect( _clientSpecMenu, SIGNAL(showClientTable(WidgetId)), this, SLOT(showWidget(WidgetId)) ); QObject::connect( _changelistMenu, SIGNAL(showPendinChangeLists(WidgetId)), this, SLOT(showWidget(WidgetId)) ); _viewMenu->connectItem( _viewMenu->getViewUsersId(), _userMenu, SLOT(slotViewUsers()) ); _viewMenu->connectItem( _viewMenu->getViewSubmittedChangeListsId(), _changelistMenu, SLOT(slotViewSubmittedChangelists()) ); _viewMenu->connectItem( _viewMenu->getViewPendingChangeListsId(), _changelistMenu, SLOT(slotViewPendingChangelists()) ); _viewMenu->connectItem( _viewMenu->getViewBranchSpecId(), _branchSpecMenu, SLOT(slotViewBranches()) ); _viewMenu->connectItem( _viewMenu->getViewJobsId(), _jobMenu, SLOT(slotViewJobs()) ); _viewMenu->connectItem( _viewMenu->getViewLabelsId(), _labelMenu, SLOT(slotViewLabels()) ); _viewMenu->connectItem( _viewMenu->getViewClientsId(), _clientSpecMenu, SLOT(slotViewClientSpecs()) ); //====================================================================== setCentralWidget( _verticalSplitter ); } void qperforceWindow::buildMenuBar() { _menuBar = new QMenuBar( this ); _statusBar = new QStatusBar( this ); _fileMenu = new FileMenu(); _menuBar->insertItem( "&File", _fileMenu ); _editMenu = new EditMenu(); _menuBar->insertItem( "&Edit", _editMenu ); _viewMenu = new ViewMenu(); _menuBar->insertItem( "&View", _viewMenu ); _settingsMenu = new SettingsMenu(); _menuBar->insertItem( "&Settings", _settingsMenu ); _changelistMenu = new ChangeListMenu(); _menuBar->insertItem( "Changelist", _changelistMenu ); _branchSpecMenu = new BranchSpecMenu(); _menuBar->insertItem( "&BranchSpec", _branchSpecMenu ); _labelMenu = new LabelMenu(); _menuBar->insertItem( "&Label", _labelMenu ); _clientSpecMenu = new ClientSpecMenu(); _menuBar->insertItem( "&ClientSpec", _clientSpecMenu ); _userMenu = new UserMenu(); _menuBar->insertItem( "&User", _userMenu ); _jobMenu = new JobMenu(); _menuBar->insertItem( "&Job", _jobMenu ); _toolsMenu = new ToolsMenu(); _menuBar->insertItem( "&Tools", _toolsMenu ); _helpMenu = new HelpMenu(); _menuBar->insertItem( "Help", _helpMenu ); } void qperforceWindow::buildToolBar() { _toolBar = new QToolBar( this, "MainToolBar" ); CHECK_PTR( _toolBar ); QToolButton* b; ImageManager* im = ImageManager::getInstance(); CHECK_PTR( im ); b = new QToolButton( im->getPixmap( "reload.png" ), "Refresh Active Pane", "Group Text", _viewMenu, SLOT(slotRefreshActivePane()), _toolBar ); _toolBar->addSeparator(); b = new QToolButton( im->getPixmap( "pending_changes.png" ), "View Pending Changelists", "Group Text", _changelistMenu, SLOT(slotViewPendingChangelists()), _toolBar ); b = new QToolButton( im->getPixmap( "changes.png" ), "View Submitted Changelist", "Group Text", _changelistMenu, SLOT(slotViewSubmittedChangelists()), _toolBar ); b = new QToolButton( im->getPixmap( "branch.png" ), "View Branchspecs", "Group Text", _branchSpecMenu, SLOT(slotViewBranches()), _toolBar ); b = new QToolButton( im->getPixmap( "label.png" ), "View Labels", "Group Text", _labelMenu, SLOT(slotViewLabels()), _toolBar ); b = new QToolButton( im->getPixmap( "client.png" ), "View Clientspecs", "Group Text", _clientSpecMenu, SLOT(slotViewClientSpecs()), _toolBar ); b = new QToolButton( im->getPixmap( "people.png" ), "View Users", "Group Text", _userMenu, SLOT(slotViewUsers()), _toolBar ); b = new QToolButton( im->getPixmap( "job.png" ), "View jobs", "Group Text", _jobMenu, SLOT(slotViewJobs()), _toolBar ); _toolBar->addSeparator(); b = new QToolButton( im->getPixmap( "configure.png" ), "Set qperforce options", "Group Text", _settingsMenu, SLOT(slotOptions()), _toolBar ); b = new QToolButton( im->getPixmap( "info.png" ), "Show connection info", "Group Text", _helpMenu, SLOT(slotShowConnectionInfo()), _toolBar ); } void qperforceWindow::setStatusMessage(const QString &m) { ASSERT( _statusBar != NULL ); _statusBar->message( m ); } void qperforceWindow::showStatusBar( bool b ) { if (_statusBar != NULL) { if (b) { _statusBar->show(); } else { _statusBar->hide(); } } } void qperforceWindow::appendUserMessage( const QString& s ) { ASSERT( _statusPane != NULL ); _statusPane->append( s ); QScrollBar* sb = _statusPane->verticalScrollBar(); sb->setValue( sb->maxValue() ); } void qperforceWindow::buildRightWidgetStack() { _userTable = new UserTable( _rightWidgetStack ); _userMenu->setListView( _userTable ); _submittedChangeListsTable = new SubmittedChangeListsTable(_rightWidgetStack); _changelistMenu->setSubmittedChangeListsView( _submittedChangeListsTable ); _branchSpecTable = new BranchSpecTable( _rightWidgetStack ); _branchSpecMenu->setListView( _branchSpecTable ); _jobTable = new JobTable( _rightWidgetStack ); _jobMenu->setListView( _jobTable ); _labelTable = new LabelTable( _rightWidgetStack ); _labelMenu->setListView( _labelTable ); _clientTable = new ClientTable( _rightWidgetStack ); _clientSpecMenu->setClientListView( _clientTable ); _pendingChangeListsTree = new PendingChangeListsTree( _rightWidgetStack ); _changelistMenu->setPendingChangeListsView( _pendingChangeListsTree ); _rightWidgetStack->addWidget( _userTable, USERS_TABLE ); _rightWidgetStack->addWidget( _submittedChangeListsTable, SUBMITTED_CHANGELISTS_TABLE ); _rightWidgetStack->addWidget( _branchSpecTable, BRANCH_SPEC_TABLE ); _rightWidgetStack->addWidget( _jobTable, JOBS_TABLE ); _rightWidgetStack->addWidget( _labelTable, LABEL_TABLE ); _rightWidgetStack->addWidget( _clientTable, CLIENTS_TABLE ); _rightWidgetStack->addWidget( _pendingChangeListsTree, PENDING_CHANGELISTS_TREE ); } void qperforceWindow::showWidget( WidgetId id ) { _rightWidgetStack->raiseWidget( id ); _rightPaneTitle->setText( _widget_names[id] ); } void qperforceWindow::postServerConnectInitialize() { _depotTree->refresh(); _userMenu->slotViewUsers(); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#15 | 2216 | Jacob Gladish | Added the .ui/xml file for the Configuration Dialog box. | ||
#14 | 2157 | Jacob Gladish | Adding initial support for the client view of the depot. | ||
#13 | 2152 | Jacob Gladish | Added a couple more images, and non-blocking server communication | ||
#12 | 2147 | Jacob Gladish | Added more functionality to the pending changes list, and added asynchronous access to the server. | ||
#11 | 2145 | Jacob Gladish | Added PendingChanges listview | ||
#10 | 2141 | Jacob Gladish |
Begun adding toolbar buttons, and added connection info. Added some missing files from project. |
||
#9 | 2128 | Jacob Gladish | Renamed changelist to change | ||
#8 | 2127 | Jacob Gladish | Added client's table. | ||
#7 | 2118 | Jacob Gladish | changed server interface to use perforce c++ api instead of p4 command. | ||
#6 | 2103 | Jacob Gladish | Added Job table | ||
#5 | 2100 | Jacob Gladish | Adding more menu's, tables, and a few icons. | ||
#4 | 2097 | Jacob Gladish | updated status pane so that is scrolls to the bottom when appending. | ||
#3 | 2095 | Jacob Gladish | Added ability to view submitted changelists. | ||
#2 | 2094 | Jacob Gladish | Added the Changelist menu | ||
#1 | 2092 | Jacob Gladish | Importing initial code |