// Implementation of QTreeFileText.
#include <clientapi.h>
#include <qapplication.h>
#include <qcanvas.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qpainter.h>
#include "qtreeitem.h"
#include "changesorter.h"
#include "filehead.h"
#include "filelogcache.h"
#include "qtreerevball.h"
#define QTREEFILEDIALOG_H
#include "qtreefiledialog.h"
#include "qtreefiletext.h"
QTreeFileText::QTreeFileText( QCanvas* canvas, char* filename, FileHead* fh )
:QCanvasText( filename, canvas), filehead( fh )
{
QFont f = QFont();
f.setBold( true );
setFont( f );
setZ( TREE_ZSTRIPETEXT );
}
QTreeFileText::~QTreeFileText()
{
}
void QTreeFileText::InfoDialog( QWidget* parent )
{
// An empty FileHead is most likely due to//
// lack of list permissions on that file.
if ( filehead->size == 0 )
{
QMessageBox::warning
(
parent,
"P4QTree Warning",
"No information about this file is available.",
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton
);
return;
}
QDialog* dia = new QTreeFileDialog( parent, filehead );
dia->exec();
delete dia;
}
int QTreeFileText::HeadX()
{
if ( !filehead->head ||
!filehead->head->revball ) return 0;
else return filehead->head->revball->x();
}
bool QTreeFileText::HeadBinary()
{
if ( !filehead->head ||
!filehead->head->revball ) return 0;
else return filehead->head->revball->IsBinary();
}
StrBuf QTreeFileText::Name()
{
return filehead->name;
}
QString QTreeFileText::Tip()
{
return QString( filehead->name.Text() );
}