1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#include <string>
#include <vector>
using namespace std;
#include <qwidget.h>
#include <qdialog.h>
#include <qmultilineedit.h>
#include <qevent.h>
#include <qfont.h>
#include "sourcebox.h"
#include "parser.h"
#include "globals.h"
#include "utility.h"
#include "preferences.h"
#include "navigation.h"
#include "files.h"
SourceBox::SourceBox() : QDialog()
{
resize( 500, 400 );
setMinimumSize( 100, 100 );
source = new QMultiLineEdit( this );
source->setReadOnly( TRUE );
source->setWordWrap( QMultiLineEdit::WidgetWidth );
setFont( config->sourceFont() );
}
void SourceBox::update( )
{
setCaption( fullPath( cPath, cCategory ).c_str() );
if( ( cPath == path ) &&
( cFile == file ) )
return;
int i;
cached( cPath, cFile, i );
vector<string> *sourcev = cacheSourcev[i];
string text;
for( unsigned int n = 0; n < sourcev->size(); n++ )
text += (*sourcev)[n] + "\n";
source->setText( text.c_str() );
path = cPath;
file = cFile;
}
void SourceBox::renew()
{
setCaption( fullPath( cPath, cCategory ).c_str() );
source->setText( debugInfo().c_str() );
}
void SourceBox::resizeEvent( QResizeEvent * )
{
source->setGeometry( 10, 10, this->width()-20, this->height()-20 );
}
|