~ubuntu-branches/debian/jessie/linpsk/jessie

« back to all changes in this revision

Viewing changes to src/ctrigger.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Hamish Moffatt
  • Date: 2005-04-10 18:17:27 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050410181727-3l9dnfg0sp7bhk13
Tags: 0.8.1-1
* New upstream release 0.8.1
  * Modified upstream configure.in to support FHS-compliant Qt
    installation! (ie /usr/include/qt3, not /usr/lib/qt3/include) :-(
  * Re-autotools with autoconf2.59 and automake-1.9
* linpsk is no longer a Debian-native package (dsc/tar.gz)
* Now maintained by the debian-hams group
* Switch to debhelper 4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "ctrigger.h"
 
3
 
 
4
#include <qvariant.h>
 
5
#include <qlineedit.h>
 
6
#include <qradiobutton.h>
 
7
#include <qlayout.h>
 
8
 
 
9
 
 
10
/* 
 
11
 *  Constructs a CTrigger which is a child of 'parent', with the 
 
12
 *  name 'name'.' 
 
13
 */
 
14
CTrigger::CTrigger( QWidget* parent,  const char* name )
 
15
    : QGroupBox( parent, name )
 
16
{
 
17
    setFrameShape( QGroupBox::WinPanel );
 
18
    setFrameShadow( QGroupBox::Raised );
 
19
    setAlignment( int( QGroupBox::AlignHCenter ) );
 
20
 
 
21
    TriggerText = new QLineEdit( this, "TriggerText" );
 
22
//    TriggerText->setMaxLength( 80 );
 
23
 
 
24
    Activate = new QRadioButton( this, "Activate" );
 
25
    languageChange();
 
26
}
 
27
 
 
28
/*
 
29
 *  Destroys the object and frees any allocated resources
 
30
 */
 
31
CTrigger::~CTrigger()
 
32
{
 
33
    // no need to delete child widgets, Qt does it all for us
 
34
}
 
35
 
 
36
/*
 
37
 *  Sets the strings of the subwidgets using the current
 
38
 *  language.
 
39
 */
 
40
void CTrigger::languageChange()
 
41
{
 
42
    setTitle( tr( "Trigger" ) );
 
43
    TriggerText->setText( tr( "CQ CQ" ) );
 
44
    Activate->setText( tr( "Activate" ) );
 
45
}
 
46
 
 
47
void CTrigger::resizeEvent( QResizeEvent * )
 
48
{
 
49
calculateSizeofComponents();
 
50
}
 
51
 
 
52
void CTrigger::calculateSizeofComponents()
 
53
{
 
54
#define LEFTANDRIGHTMARGIN 5
 
55
#define TOP 30
 
56
#define LABELHEIGHT 30
 
57
int xpos,ypos,width,height,innerwidth,innerheight;
 
58
width=this->width();
 
59
height=this->height();
 
60
xpos=width*LEFTANDRIGHTMARGIN/100;
 
61
ypos=height*TOP/100;
 
62
innerwidth=width-2*xpos;
 
63
innerheight=height*LABELHEIGHT/100;
 
64
TriggerText->setGeometry(xpos,ypos,innerwidth,innerheight);
 
65
ypos=ypos+innerheight;
 
66
Activate->setGeometry(xpos+1,ypos,innerwidth-2,innerheight);
 
67
this->setFrameRect(QRect(0,0,width,height));
 
68
}