// // 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 // #include "UserMenu.h" #include "ConfigOptions.h" #include "ImageManager.h" #include "P4Client.h" #include "ServerThread.h" #include "todo.h" #include "User.h" #include "WidgetId.h" #include <qthread.h> UserMenu::UserMenu( QWidget* parent, const char* name ) : QPopupMenu( parent, name ) { insertItem( "New..", this, SLOT(slotNew()) ); insertItem( "Edit...", this, SLOT(slotEdit()) ); insertItem( "Describe...", this, SLOT(slotDescribe()) ); insertItem( "Delete", this, SLOT(slotDelete()) ); insertSeparator(); insertItem( "Set Password for...", this, SLOT(slotSetPasswordFor()) ); insertItem( "Switch to User", this, SLOT(slotSwitchToUser()) ); insertItem( "Set Default User", this, SLOT(slotSetDefaultUser()) ); insertSeparator(); insertItem( "View Changes by", this, SLOT(slotViewChangesBy()) ); insertItem( ImageManager::getInstance()->getPixmap("people.png"), "View Users", this, SLOT(slotViewUsers()) ); } UserMenu::~UserMenu() { } void UserMenu::slotNew() { TODO(); } void UserMenu::slotEdit() { TODO(); } void UserMenu::slotDescribe() { TODO(); } void UserMenu::slotDelete() { TODO(); } void UserMenu::slotSetPasswordFor() { TODO(); } void UserMenu::slotSwitchToUser() { TODO(); } void UserMenu::slotSetDefaultUser() { TODO(); } void UserMenu::slotViewChangesBy() { TODO(); } void UserMenu::setListView( UserTable* view ) { ASSERT( view != NULL ); _myView = view; } void UserMenu::slotViewUsers() { ServerThread< UserMenu, UserMenuMemeberFunction >* t; t = new ServerThread< UserMenu, UserMenuMemeberFunction >( this, &UserMenu::_slotViewUsers ); } void UserMenu::_slotViewUsers() { _myView->clear(); Perforce::UserList l = Perforce::User::getUsers(); for (Perforce::User* u = l.first(); u != NULL; u = l.next()) { // do something with these guys. ASSERT( u != NULL ); ASSERT( _myView != NULL ); _myView->addUser( u ); // qDebug( "%s %s %s %s", // u->getFullName().latin1(), // u->getUserName().latin1(), // u->getEmail().latin1(), // u->getLastAccessed().toString().latin1() ); } // signal that we're showing the users emit showUsers( USERS_TABLE ); } //======================================================================== // The UserTable is not in the perforce namespace // UserTable::UserTable( QWidget* parent, const char* name ) : QListView( parent, name ) { rightClickMenu = NULL; // setNumCols( 4 ); setSelectionMode( Single ); setAllColumnsShowFocus( true ); addColumn( "Name" ); addColumn( "Email" ); addColumn( "Full Name" ); addColumn( "Last Accessed" ); // set up right click menu. QObject::connect( this, SIGNAL(rightButtonClicked(QListViewItem *,const QPoint &, int)), this, SLOT(onRightClick(QListViewItem *,const QPoint &, int)) ); } void UserTable::addUser( const Perforce::User* u ) { ASSERT( u != NULL ); // qDebug( "Adding user to view: %s", u->getUserName().latin1() ); QListViewItem* item = new QListViewItem( this, u->getUserName(), u->getEmail(), u->getFullName(), u->getLastAccessed().toString() ); item->setPixmap( 0, ImageManager::getInstance()->getPixmap("user.png") ); } void UserTable::onRightClick( QListViewItem* item, const QPoint& point, int column ) { // qDebug( "Item: %s", static_cast<const char *>(item->text(0)) ); // qDebug( "Column: %d", column ); if (rightClickMenu == NULL) { rightClickMenu = new QPopupMenu( this ); rightClickMenu->insertItem( "New" ); describeId = rightClickMenu->insertItem( "Describe " + item->text(0) + "..." ); rightClickMenu->insertSeparator(); switchToId = rightClickMenu->insertItem( "Switch to " + item->text(0) ); rightClickMenu->insertSeparator(); viewChangesById = rightClickMenu->insertItem( "View changes by " + item->text(0) ); rightClickMenu->insertItem( "Refresh" ); } else { // rightClickMenu->changeItem( rightClickMenu->changeItem( describeId, "Describe " + item->text(0) + "..." ); rightClickMenu->changeItem( switchToId, "Switch to " + item->text(0) ); rightClickMenu->changeItem( viewChangesById, "View changes by " + item->text(0) ); } rightClickMenu->exec( QCursor::pos() ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#9 | 3782 | Jacob Gladish | I have no clue... | ||
#8 | 2152 | Jacob Gladish | Added a couple more images, and non-blocking server communication | ||
#7 | 2147 | Jacob Gladish | Added more functionality to the pending changes list, and added asynchronous access to the server. | ||
#6 | 2128 | Jacob Gladish | Renamed changelist to change | ||
#5 | 2118 | Jacob Gladish | changed server interface to use perforce c++ api instead of p4 command. | ||
#4 | 2103 | Jacob Gladish | Added Job table | ||
#3 | 2098 | Jacob Gladish |
changed the IUpdateable abstract class to be a template. The template parameter is the structure that backs the storage for the class. |
||
#2 | 2095 | Jacob Gladish | Added ability to view submitted changelists. | ||
#1 | 2092 | Jacob Gladish | Importing initial code |