summaryrefslogtreecommitdiffstats
path: root/src/kile/kilestatswidget.cpp
blob: 601f5081620eca0093c679e92c4a4d1315f528a0 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/***************************************************************************
    begin                : Tuesday Nov 15 2005
    copyright            : (C) 2005 by Holger Danielsson
    email                : holger.danielsson@t-online.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "kilestatswidget.h"
  
#include <kdialog.h>
#include <klocale.h>

#include <tqvariant.h>
#include <tqlabel.h>
#include <tqbuttongroup.h>
#include <tqlayout.h>
#include <tqtooltip.h>
#include <tqwhatsthis.h>
#include "kiledebug.h"

KileWidgetStatistics::KileWidgetStatistics( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
	TQVBoxLayout *vbox = new TQVBoxLayout(parent, 5,KDialog::spacingHint() );

	// characters groupbox
	TQGroupBox *chargroup = new TQGroupBox( i18n("Characters"),parent); 
	chargroup->setColumnLayout(0, Qt::Vertical );
	chargroup->tqlayout()->setSpacing( 6 );
	chargroup->tqlayout()->setMargin( 11 );
	chargrouptqlayout = new TQGridLayout( chargroup->tqlayout() );
	chargrouptqlayout->setAlignment( TQt::AlignTop );

	m_wordCharText = new TQLabel(i18n("Words and numbers:"), chargroup);
	m_commandCharText = new TQLabel(i18n("LaTeX commands and environments:"), chargroup);
	m_whitespaceCharText = new TQLabel(i18n("Punctuation, delimiter and whitespaces:"), chargroup);
	m_totalCharText = new TQLabel(i18n("Total characters:"), chargroup);
	m_wordChar = new TQLabel( chargroup, "m_wordChar" );
	m_commandChar = new TQLabel( chargroup, "m_commandChar" );
	m_whitespaceChar = new TQLabel( chargroup, "m_whitespaceChar" );
	m_totalChar = new TQLabel( chargroup, "m_totalChar" );

	TQFrame *charframe = new TQFrame(chargroup);
	charframe->setFrameStyle(TQFrame::HLine | TQFrame::Sunken);
	charframe->setLineWidth(1);

	chargrouptqlayout->addWidget( m_wordCharText, 0,0 );
	chargrouptqlayout->addWidget( m_commandCharText, 1,0 );
	chargrouptqlayout->addWidget( m_whitespaceCharText, 2,0 );
	chargrouptqlayout->addWidget( m_totalCharText, 4,0 );
	chargrouptqlayout->addWidget( m_wordChar, 0,2,TQt::AlignRight );
	chargrouptqlayout->addWidget( m_commandChar, 1,2,TQt::AlignRight );
	chargrouptqlayout->addWidget( m_whitespaceChar, 2,2,TQt::AlignRight );
	chargrouptqlayout->addMultiCellWidget( charframe, 3,3,1,2 );
	chargrouptqlayout->addWidget( m_totalChar, 4,2,TQt::AlignRight );
	chargrouptqlayout->setColSpacing(1,16);
	chargrouptqlayout->setColSpacing(3,1);
	chargrouptqlayout->setColStretch(3,1);

	// string groupbox
	TQGroupBox *stringgroup = new TQGroupBox( i18n("Strings"),parent);
	stringgroup->setColumnLayout(0, Qt::Vertical );
	stringgroup->tqlayout()->setSpacing( 6 );
	stringgroup->tqlayout()->setMargin( 11 );
	stringgrouptqlayout = new TQGridLayout( stringgroup->tqlayout() );
	stringgrouptqlayout->setAlignment( TQt::AlignTop );

	m_wordStringText = new TQLabel(i18n("Words:"), stringgroup);
	m_commandStringText = new TQLabel(i18n("LaTeX commands:"), stringgroup);
	m_environmentStringText = new TQLabel(i18n("LaTeX environments:"), stringgroup);
	m_totalStringText = new TQLabel(i18n("Total strings:"), stringgroup);
	m_wordString = new TQLabel( stringgroup, "m_wordString" );
	m_commandString = new TQLabel( stringgroup, "m_commandStringText" );
	m_environmentString = new TQLabel( stringgroup, "m_environmentStringText" );
	m_totalString = new TQLabel( stringgroup, "m_totalStringText" );

	TQFrame *stringframe = new TQFrame(stringgroup);
	stringframe->setFrameStyle(TQFrame::HLine | TQFrame::Sunken);
	stringframe->setLineWidth(1);

	stringgrouptqlayout->addWidget( m_wordStringText, 0,0 );
	stringgrouptqlayout->addWidget( m_commandStringText, 1,0 );
	stringgrouptqlayout->addWidget( m_environmentStringText, 2,0 );
	stringgrouptqlayout->addWidget( m_totalStringText, 4,0 );
	stringgrouptqlayout->addWidget( m_wordString, 0,2,TQt::AlignRight );
	stringgrouptqlayout->addWidget( m_commandString, 1,2,TQt::AlignRight );
	stringgrouptqlayout->addWidget( m_environmentString, 2,2,TQt::AlignRight );
	stringgrouptqlayout->addMultiCellWidget( stringframe, 3,3,1,2 );
	stringgrouptqlayout->addWidget( m_totalString, 4,2,TQt::AlignRight );
	stringgrouptqlayout->setColSpacing(1,16);
	stringgrouptqlayout->setColSpacing(3,1);
	stringgrouptqlayout->setColStretch(3,1);

	m_commentAboutHelp = new TQLabel(parent);
	m_warning =  new TQLabel(parent);
 
	vbox->addWidget(chargroup);
	vbox->addWidget(stringgroup);
	vbox->addSpacing(12);
	vbox->addWidget(m_commentAboutHelp);
	vbox->addWidget(m_warning);
	vbox->addStretch(1);

	int w = m_commandCharText->sizeHint().width();
	if ( m_whitespaceCharText->sizeHint().width() > w )
		w = m_whitespaceCharText->sizeHint().width();
	stringgrouptqlayout->setColSpacing(0,w);

}

KileWidgetStatistics::~KileWidgetStatistics()
{
}

void KileWidgetStatistics::updateColumns()
{
	int w = m_totalChar->sizeHint().width();
	if ( m_totalString->sizeHint().width() > w )
		w = m_totalString->sizeHint().width();
	chargrouptqlayout->setColSpacing(2,w);
	stringgrouptqlayout->setColSpacing(2,w);
}


#include "kilestatswidget.moc"