// QTreeWindow: the main widget for P4QTree. #ifndef QTREEWINDOW_H #include <clientapi.h> #include <qbitmap.h> #include <qcanvas.h> #include <qlabel.h> #include <qmenubar.h> #include <qtooltip.h> #include "changesorter.h" #include "filehead.h" #include "filelogcache.h" #include "qtreeitem.h" #include "clientjobdescuser.h" #include "qtreejobtext.h" #include "qtreejobbar.h" #include "clientchangeuser.h" #include "qtreechangenum.h" #include "qtreechangebar.h" #include "qtreerevtext.h" #include "qtreerevball.h" #include "qtreefiletext.h" #include "qtreefilestripe.h" #include "qtreearrow.h" #include "qtreecanvas.h" #include "qtreetooltip.h" #include "qtreeprefsdialog.h" #include "qtreelegenddialog.h" extern bool console; #endif // QTREEWINDOW_H #include "qtreeeasteregg.h" class QTreeChangeView; class QTreeWindow : public QCanvasView { Q_OBJECT public: // Arguments to the constructor: // parent: the parent window (NULL if this is the main window) // depotfile: name of a Perforce file // client: a ClientApi with settings already set // error: any old blank Error // showjobs: should the job bar be created? // isbirds: is this a branching-only window? // wflags: normal widget flags QTreeWindow( QWidget* parent, char* depotfile, ClientApi* client, Error* error, bool isbirds, char* cfile ); virtual ~QTreeWindow(); // Set maximum size, tend to scrollbars, et cetera. void AdjustGeometry(); // Center view on head rev of "main" file void CenterOnMain(); bool IsEmpty() { return ( !qtcanvas || qtcanvas->IsEmpty() || !filelabel || !changeview ); } ; // Spit contents of "error" to a dialog. void HandleError(); int HandleFatalError(); // Load preferences from QSettings. void LoadSettings(); // Save image directly to filename.png. void SaveImage( QString filename ); ClientApi* client; Error* error; QMenuBar* menubar; char* cachefile; protected: // Intercept events and AdjustGeometry() before handling them. bool event( QEvent* e ); // Drag 'n drop. void contentsMousePressEvent( QMouseEvent* e ); void contentsDragEnterEvent( QDragEnterEvent* e ); void contentsDropEvent( QDropEvent* e ); // Double-click. void contentsMouseDoubleClickEvent( QMouseEvent* e ); // Overriden method to give space to the menu bar. void setVBarGeometry ( QScrollBar & vbar, int x, int y, int w, int h ); void keyPressEvent( QKeyEvent* e ) { egg->KeyPress( e->key() ); } ; public slots: // Scroll filetexts. void HorizScroll( int x, int y ); // Pop up an About dialog. void AboutDialog(); // Pop up the -h "usage" dialog. static void UsageDialog( QWidget* parent=NULL ); // Save canvas to a PNG. void SaveImage(); // Print canvas. void PrintImage(); // Pop up a miniature branch-only window. void SpawnMini(); // Toggle job bar on and off. void ToggleJobs(); // Preferences dialog. void Preferences(); // Legend dialog void Legend(); // Refresh void Refresh(); private: // init methods void InitMenus(); void InitIcons(); // basic contents QTreeCanvas* qtcanvas; QTreeChangeView* changeview; // settings char* mainfile; bool birdseyeview; bool havejobbar; bool jobsvisible; bool showall; QString startdate, startchange, endcd; bool binary; //do binary diffs? QTreeWindow* minime; // child "branch view" window QDialog* legend; // child "legend" window QLabel* filelabel; // widget at left of window QCanvasItem* dragsource; // source of current drag // extra attachments QPixmap appicon; QTreeToolTip tips; QTreeEasterEgg* egg; };
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#10 | 4450 | Sam Stafford |
Slight refactoring of "name sort" code... this was to lead to an implementation of "directory graphing" but it didn't pan out. Will need to kludge more than previously thought to make that happen. |
||
#9 | 4428 | Sam Stafford |
Suppress error dialogs if "-o" option specified - dump to stderr instead. (This was a quick hack - hopefully it works.) |
||
#8 | 4419 | Sam Stafford |
Framework for command line alphabetical sort option. No functional change (still need to implement the sort algorithm). |
||
#7 | 4410 | Sam Stafford |
New feature for Laura: "-o OUTPUT" option. When P4QTree is invoked with this option, it'll attempt to dump a PNG file of the graph and then exit. Along the way I removed the silly SVG format thing and switched it back to PNG - nobody can read SVG anyway. Caveat: to write to PNG format, it needs to load the entire image into memory as an uncompressed pixmap, so a large graph very well might not fit in memory. If that happens, you should get a friendly error message and the operation will fail. I can't imagine anybody outside these walls having a use for this option, so I won't bother documenting it. |
||
#6 | 2947 | Sam Stafford |
Give P4QTree the ability to read filelog data from a supplied text file. The syntax is: P4QTree [g-opts] [-F cachefile] depotfile The data in the supplied file will be read before the server is queried for a given filelog. If a required filelog is not found in the file, the server will be queried instead. The most handy application for this that I can see is quickly graphing integ scenarios based on customer-supplied (or even manually-generated) filelogs, when for whatever reason it's not feasible to access the server directly. |
||
#5 | 2457 | Sam Stafford |
Print and Save features. The Print feature is kinda wudgy - it shrinks the canvas down to fit on a single page, which can make it pretty durn small. It also makes hardcoded assumptions about page size because I was having a tough time extracting that info from QPrinter. And lastly, it does a pretty bad job scaling down the text. All that aside, I can see it being useful under a very narrow set of circumstances, so here it is. The Save feature only exports to SVG format, per QPicture's limitations, and it doesn't even do that correctly. It boggles the mind, really. |
||
#4 | 2405 | Sam Stafford | Add support for binary diff programs, as well as "-l" and "-r" for P4Diff and SQUID. | ||
#3 | 2399 | Sam Stafford | The "show all integs" feature in all its glory. | ||
#2 | 2390 | Sam Stafford | Move app icon code to InitIcons(), and maintain the QPixmap with the icon as a class member - this seems to fix that mysterious crashing bug that was introduced when I added the app icon in the first place. | ||
#1 | 2377 | Sam Stafford | P4QTree. |