~ubuntu-branches/ubuntu/quantal/linpsk/quantal

« back to all changes in this revision

Viewing changes to linpsk/setup.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Bruce Walker
  • Date: 2002-02-06 11:43:38 UTC
  • Revision ID: james.westby@ubuntu.com-20020206114338-xqmjmhh01lpjm0g4
Tags: upstream-0.6.2
ImportĀ upstreamĀ versionĀ 0.6.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          setup.cpp  -  description
 
3
                             -------------------
 
4
    begin                : Tue Apr 4 2000
 
5
    copyright            : (C) 2000 by Volker Schroer
 
6
    email                : DL1KSV@gmx.de
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *    based on the work of  Moe Wheatly, AE4JY                             *  
 
16
 ***************************************************************************/
 
17
#include "setup.h"
 
18
 
 
19
extern bool checkcom(char *s);
 
20
extern int getVolume(int Device);
 
21
extern int getOutputVolume();
 
22
 
 
23
Setup::Setup(QWidget *parent, const char *name) : FSetup(parent,name,TRUE)
 
24
{
 
25
QString s;
 
26
 
 
27
// DemoMode
 
28
  demoMode=settings.DemoMode;
 
29
        DemoMode->setChecked(demoMode);
 
30
        if (demoMode)
 
31
        {
 
32
                DemoInputMode->show();
 
33
                DemoInputMode->setButton(settings.DemoTypeNumber);
 
34
        }       
 
35
else
 
36
        DemoInputMode->hide();  
 
37
 
 
38
// Callsign
 
39
        
 
40
  UserCallSign->setText(settings.callsign);
 
41
 
 
42
// Station File
 
43
        SendFile->setText(settings.StationFile);
 
44
 
 
45
// TimeOffset
 
46
  TimeOffset->setText(s.setNum(settings.timeoffset));
 
47
 
 
48
// UserDefined Button
 
49
        ButtonName->setText(settings.ButtonName);
 
50
 
 
51
// Corresponding ButtonFile
 
52
        ButtonFile->setText(settings.ButtonFile);
 
53
// Input Source (Ugly coding)
 
54
        if (settings.InputSource == SOUND_MIXER_MIC)
 
55
        InputSelect->setButton(0);
 
56
                if (settings.InputSource == SOUND_MIXER_LINE)
 
57
        InputSelect->setButton(1);
 
58
        InputSource = settings.InputSource;
 
59
        setInputSource(InputSource);
 
60
 
 
61
// InputLevel
 
62
        level = getVolume(settings.InputSource);
 
63
        InputLevel->setValue(level);
 
64
        
 
65
// OutputLevel
 
66
        OutputLevel->setValue(getOutputVolume());
 
67
 
 
68
// slashedZero
 
69
        slashed0=settings.slashed0;
 
70
        slashedZero->setChecked(slashed0);
 
71
 
 
72
 
 
73
//  PTTControl
 
74
        if(!checkcom("/dev/ttyS0"))
 
75
                Com1->hide();
 
76
                
 
77
 
 
78
        if(!checkcom("/dev/ttyS1"))
 
79
                 Com2->hide();
 
80
 
 
81
  if(!checkcom("/dev/ttyS2"))
 
82
                Com3->hide();
 
83
 
 
84
 
 
85
        if(!checkcom("/dev/ttyS3"))
 
86
                Com4->hide();
 
87
  ptt=settings.ptt;
 
88
        PTTControl->setButton(ptt);
 
89
 
 
90
// Number of receive windows
 
91
  RxChannels->setValue(settings.RxChannels);
 
92
        
 
93
}
 
94
 
 
95
Setup::~Setup(){
 
96
}
 
97
 
 
98
/** Sets the Demomode on or off */
 
99
void Setup::setDemoMode(bool mode)
 
100
{
 
101
demoMode=mode;
 
102
}
 
103
 
 
104
 
 
105
void Setup::setComPort(int port)
 
106
{
 
107
ptt=port;
 
108
}
 
109
 
 
110
void Setup::setSlashed0(bool zero)
 
111
{
 
112
slashed0=zero;
 
113
}
 
114
 
 
115
 
 
116
void Setup::setInputLevel(int SelectedLevel)
 
117
 
 
118
{
 
119
        level=SelectedLevel;
 
120
        setVolume(InputSource,level);
 
121
}
 
122
 
 
123
 
 
124
void Setup::setOutputLevel(int level)
 
125
 
 
126
{
 
127
        setOutputVolume(level);
 
128
}
 
129
/** Activates/Deactivates the SubWindow for the different Demo's */
 
130
void Setup::activateTypeWindow(bool type)
 
131
{
 
132
if (type)
 
133
        {
 
134
                DemoInputMode->show();
 
135
                demoMode= true;
 
136
        }       
 
137
else
 
138
        {
 
139
                DemoInputMode->hide();
 
140
                demoMode = false;
 
141
        }       
 
142
}
 
143
/** Selects the type of the input file
 
144
1 wav
 
145
2 text , sample rate 11025 */
 
146
void Setup::selectDemoType(int type)
 
147
{
 
148
 DemoTypeNumber = type;
 
149
 
 
150
}
 
151
 
 
152
void Setup::selectInput(int source)
 
153
{
 
154
if (source == 0)
 
155
        {
 
156
                setInputSource(SOUND_MIXER_MIC);
 
157
                InputSource=SOUND_MIXER_MIC;
 
158
         }      
 
159
if (source == 1)
 
160
        {
 
161
                setInputSource(SOUND_MIXER_LINE);       
 
162
                InputSource=SOUND_MIXER_LINE;
 
163
        }       
 
164
        
 
165
setInputLevel(level);   
 
166
}