File: ReceiveDialog.cpp

package info (click to toggle)
hamfax 0.5.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 416 kB
  • ctags: 441
  • sloc: cpp: 3,188; sh: 197; makefile: 124
file content (98 lines) | stat: -rw-r--r-- 2,704 bytes parent folder | download
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
// HamFax -- an application for sending and receiving amateur radio facsimiles
// Copyright (C) 2001 Christof Schmitt, DH1CS <cschmitt@users.sourceforge.net>
//  
// 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.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//  
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "ReceiveDialog.hpp"
#include <qlayout.h>

ReceiveDialog::ReceiveDialog(QWidget* parent)
	: QDialog(parent)
{
        setCaption(parent->caption());
	QVBoxLayout* layout=new QVBoxLayout(this,15,15);
	layout->addWidget(status=new QLabel(this));
	status->setMinimumWidth(200);
	layout->addWidget(aptText=new QLabel(this));
	layout->addWidget(level=new DisplayLevel(this));
	layout->addWidget(spectrum=new Spectrum(this));
	layout->addWidget(skip=new QPushButton(this));
	connect(skip,SIGNAL(clicked()),this,SIGNAL(skipClicked()));
	layout->addWidget(cancel=new QPushButton(tr("&Cancel"),this));
	connect(cancel,SIGNAL(clicked()),this,SIGNAL(cancelClicked()));
}

void ReceiveDialog::apt(int f)
{
	aptText->setText(QString(tr("Apt frequency: %1 Hz")).arg(f));
}

void ReceiveDialog::closeEvent(QCloseEvent* close)
{
	close->ignore();
	if(cancel->isEnabled()) {
		emit cancelClicked();
	}
}

void ReceiveDialog::reject(void)
{
	// the escape key leads here
	if(cancel->isEnabled()) {
		emit cancelClicked();
	}
}

void ReceiveDialog::aptStart(void)
{
	status->setText(tr("searching APT start tone"));
	skip->setDisabled(false);
	level->setZero();
	skip->setText(tr("&Skip apt start"));
	show();
}

void ReceiveDialog::phasing(void)
{
	status->setText(tr("decoding phasing"));
	skip->setText(tr("skip phasing"));
	skip->setDisabled(false);
}

void ReceiveDialog::phasingLine(double lpm)
{
	status->setText(QString(tr("phasing line, lpm %1")).arg(lpm,0,'f',1));
	skip->setDisabled(true);
}

void ReceiveDialog::imageRow(int row)
{
	status->setText(tr("receiving line %1").arg(row));
}

void ReceiveDialog::samples(short* buffer, int n)
{
	level->samples(buffer,n);
}

void ReceiveDialog::imageData(int* buffer, int n)
{
	spectrum->samples(buffer,n);
}

void ReceiveDialog::disableSkip(void)
{
	skip->setDisabled(true);
}