1
/***************************************************************************
2
|FILENAME| - description
5
copyright : (C) |YEAR| by |AUTHOR|
7
***************************************************************************/
9
/***************************************************************************
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
* The PSK part is based on WinPSK 1.0 by Moe Wheatly, AE4JY *
16
***************************************************************************/
21
#include "controlpanel.h"
22
#include "crxdisplay.h"
23
#include "ctxdisplay.h"
25
#include "parameter.h"
26
#include "addrxwindow.h"
27
#include "spectrumdisplay.h"
28
#include "frequencyselect.h"
29
#include "cledbutton.h"
30
#include "rttymodulator.h"
31
#include "pskmodulator.h"
32
#include "bpskmodulator.h"
33
#include "qpskmodulator.h"
34
#include "mfskmodulator.h"
35
#include "ctxbuffer.h"
36
#include "crxchannel.h"
38
#include "textinput.h"
39
#include "waveinput.h"
41
#include "generalsettings.h"
43
#include "macrowindow.h"
45
#include "deletemacro.h"
48
#include "editmacro.h"
49
#include "deletemacro.h"
50
#include "renamemacro.h"
52
#include "crecording.h"
65
#define ProgramName "LinPSK "
67
extern Parameter settings;
69
* Constructs a LinPSK as a child of 'parent', with the
70
* name 'name' and widget flags set to 'f'.
73
LinPSK::LinPSK ( QWidget* parent, Qt::WFlags fl )
74
: QMainWindow ( parent, fl )
80
SaveParameters = new Parameter();
82
Macro = new Macros(); // Macros will be used in read_config
85
if ( settings.ApplicationFont == 0 )
87
settings.ApplicationFont = new QFont ( qApp->font().family() );
88
settings.ApplicationFont->setPixelSize ( 10 );
89
qApp->setFont ( *settings.ApplicationFont );
92
qApp->setFont ( *settings.ApplicationFont );
94
// Save Settings to be able to make local modifications
95
*SaveParameters = settings;
97
if ( WindowColors.size() == 0 )
98
WindowColors << color[0] ;
100
setCentralWidget ( new QWidget ( this ) );
101
centralWidget()->setMinimumSize ( settings.MinimumWindowWidth, settings.MinimumWindowHeight );
102
setWindowTitle ( QString ( ProgramName ) + QString ( VERSION ) );
103
setWindowIcon ( QIcon ( ":/images/linpsk.png" ) );
105
QStatusBar *StatusBar = this->statusBar();
106
StatusBar->setSizeGripEnabled ( true );
110
msg = new QLabel ( StatusBar );
111
StatusBar->addPermanentWidget ( msg, 2 );
112
msg->setText ( tr ( "Ready" ) );
115
IMD = new QLabel ( StatusBar );
116
StatusBar -> addPermanentWidget ( IMD, 1 );
120
zeit = new QLabel ( StatusBar );
121
StatusBar->addPermanentWidget ( zeit, 1 );
124
datum = new QLabel ( StatusBar );
125
StatusBar ->addPermanentWidget ( datum, 1 );
129
QTimer *clock = new QTimer ( this );
130
connect ( clock, SIGNAL ( timeout() ), SLOT ( setclock() ) );
131
clock->start ( 60000 );
133
RxDisplay = new CRxDisplay ( centralWidget() );
134
TxDisplay = new CTxDisplay ( centralWidget() );
136
Control = new ControlPanel ( Macro, centralWidget() );
137
RxDisplay->RxFreq->setAfcDisplayMode ( settings.ActChannel->AfcProperties() );
138
RxDisplay->RxFreq->setAfcMode ( settings.ActChannel->getAfcMode() );
139
RxDisplay->setColorList ( &WindowColors );
140
connect ( RxDisplay, SIGNAL ( copyCallSign ( QString ) ), Control->QSO, SLOT ( copyCallSign ( QString ) ) );
141
connect ( RxDisplay, SIGNAL ( copyQTH ( QString ) ), Control->QSO, SLOT ( copyQTH ( QString ) ) );
142
connect ( RxDisplay, SIGNAL ( copyName ( QString ) ), Control->QSO, SLOT ( copyName ( QString ) ) );
143
connect ( RxDisplay, SIGNAL ( copyLocator ( QString ) ), Control->QSO, SLOT ( copyLocator ( QString ) ) );
144
connect ( RxDisplay, SIGNAL ( copyRST ( QString ) ), Control->QSO, SLOT ( copyRST ( QString ) ) );
146
settings.QslData = settings.ActChannel->getQsoData();
147
Control->Display->setPhasePointer ( settings.ActChannel->getPhasePointer() );
149
Control->Display->setColorList ( &WindowColors );
150
//Control->MacroBox->updateMacroWindow ( Macro );
154
fileMenu = menubar->addMenu ( tr ( "File" ) );
157
editMenu = menubar->addMenu ( tr ( "Settings" ) );
159
menubar->addSeparator();
161
changeRxParams = menubar->addMenu ( tr ( "RxParams" ) );
162
helpMenu = menubar->addMenu ( tr ( "Help" ) );
165
// ================= File Actions ========
166
A = fileMenu->addAction ( tr ( "Open Demo File" ) );
167
connect ( A, SIGNAL ( activated() ), this, SLOT ( fileOpen() ) );
168
A = fileMenu->addAction ( tr ( "add RxWindow" ) );
169
connect ( A, SIGNAL ( activated() ), this, SLOT ( addRxWindow() ) );
171
fileMenu->addSeparator();
172
fileMenu->addSeparator();
174
A = fileMenu->addAction ( tr ( "Exit" ) );
175
connect ( A, SIGNAL ( activated() ), this, SLOT ( Exit() ) );
178
// ================= Settings Actions=================
179
A = editMenu->addAction ( tr ( "General_Settings" ) );
180
connect ( A, SIGNAL ( activated() ), this, SLOT ( generalSettings() ) );
181
editMenu->addSeparator();
182
A = editMenu->addAction ( tr ( "Add Macros" ) );
183
connect ( A, SIGNAL ( activated() ), this, SLOT ( addMacro() ) );
184
A = editMenu->addAction ( tr ( "Edit Macros" ) );
185
connect ( A , SIGNAL ( activated() ), this, SLOT ( editMacro() ) );
186
A = editMenu->addAction ( tr ( "Delete Macros" ) );
187
connect ( A , SIGNAL ( activated() ), this, SLOT ( deleteMacro() ) );
188
A = editMenu->addAction ( tr ( "Rename Macros" ) );
189
connect ( A , SIGNAL ( activated() ), this, SLOT ( renameMacro() ) );
190
//===============================================================================
191
A = editMenu->addSeparator();
193
A = editMenu->addAction ( tr ( "Font Settings" ) );
194
connect ( A , SIGNAL ( activated() ), this, SLOT ( FontSetup() ) );
195
A = editMenu->addAction ( tr ( "ColorSettings" ) );
196
connect ( A , SIGNAL ( activated() ), this, SLOT ( chooseColor() ) );
197
editMenu->addSeparator();
199
A = editMenu->addAction ( tr ( "Save Settings" ) );
200
connect ( A , SIGNAL ( activated() ), this, SLOT ( saveSettings() ) );
202
//================Actions for RX Window ===========
203
A = changeRxParams->addAction ( tr ( "Change Rx Mode" ) );
204
connect ( A , SIGNAL ( activated() ), this, SLOT ( setRxMode() ) );
205
// A= changeRxParams->addAction(tr( " ???") );
206
// connect ( A , SIGNAL ( activated() ), settings.ActChannel, SLOT ( clearRxWindow() ) );
208
// ================= Help Actions =========
209
A = helpMenu->addAction ( tr ( "helpContentsAction" ) );
210
connect ( A, SIGNAL ( activated() ), this, SLOT ( helpIndex() ) );
211
A = helpMenu->addAction ( tr ( "helpIndexAction" ) );
212
connect ( A, SIGNAL ( activated() ), this, SLOT ( helpContents() ) );
213
A = helpMenu->addAction ( tr ( "helpAboutAction" ) );
214
connect ( A, SIGNAL ( activated() ), this, SLOT ( helpAbout() ) );
219
// signals and slots connections
221
//================================= Rx Parames ===================
222
//================================================================
223
connect ( TxDisplay, SIGNAL ( startRx() ), this, SLOT ( startRx() ) );
224
connect ( TxDisplay, SIGNAL ( startTx() ), this, SLOT ( startTx() ) );
225
connect ( Macro, SIGNAL ( StartRx() ), this, SLOT ( startRx() ) );
226
connect ( Macro, SIGNAL ( StartTx() ), this, SLOT ( startTx() ) );
228
connect ( RxDisplay, SIGNAL ( startPlotting ( double *, bool ) ), Control->Display, SLOT ( startPlot ( double *, bool ) ) );
229
connect ( Control->Display, SIGNAL ( FrequencyChanged ( double ) ), RxDisplay->RxFreq, SLOT ( setFrequency ( double ) ) );
230
connect ( RxDisplay, SIGNAL ( new_IMD ( float ) ), this, SLOT ( setIMD ( float ) ) );
231
connect ( Control->MacroBox, SIGNAL ( callMacro ( int ) ), this, SLOT ( executeMacro ( int ) ) );
232
connect ( RxDisplay, SIGNAL ( newActiveChannel() ), this, SLOT ( setChannelParams() ) );
233
connect ( RxDisplay->Recording->Record, SIGNAL ( toggled ( bool ) ), this, SLOT ( recording ( bool ) ) );
234
//===================================================================
236
TxBuffer = new CTxBuffer();
237
TxDisplay->TxWindow->setTxBuffer ( TxBuffer );
243
* Destroys the object and frees any allocated resources
248
// no need to delete child widgets, Qt does it all for us
252
* Sets the strings of the subwidgets using the current
255
void LinPSK::languageChange()
259
Open_Demo_File->setText( tr( "Open Demo File" ) );
260
Open_Demo_File->setMenuText( tr( "&Open Demo File" ) );
261
Open_Demo_File->setAccel( tr( "Ctrl+O" ) );
262
fileExitAction->setText( tr( "Exit" ) );
263
fileExitAction->setMenuText( tr( "E&xit" ) );
264
fileExitAction->setAccel( QString::null );
266
helpContentsAction->setText( tr( "Contents" ) );
267
helpContentsAction->setMenuText( tr( "&Contents..." ) );
268
helpContentsAction->setAccel( QString::null );
269
helpIndexAction->setText( tr( "Index" ) );
270
helpIndexAction->setMenuText( tr( "&Index..." ) );
271
helpIndexAction->setAccel( QString::null );
272
helpAboutAction->setText( tr( "About" ) );
273
helpAboutAction->setMenuText( tr( "&About" ) );
274
helpAboutAction->setAccel( QString::null );
275
add_Rx_Window->setText( tr( "add Rx Window" ) );
276
add_Rx_Window->setMenuText( tr( "&Add another RxWindow" ) );
278
General_Settings->setText( tr( "General Settings" ) );
279
AddMacros->setText( tr( "Add Macro" ) );
280
FontSettings->setText( tr( "Font Settings" ) );
281
ColorSettings->setText( tr( "Color Settings" ) );
282
EditMacros->setText( tr( "Edit Macro" ) );
283
DeleteMacros->setText( tr("Delete Macro") );
284
RenameMacros->setText( tr("Rename Macro") );
285
// EditFiles->setText( tr( "Edit Files" ) );
286
SaveSettings->setText( tr( "Save Settings" ) );
288
Clear_RxWindow->setMenuText( tr ("Clear active RX Channel") );
289
ChangeRxMode->setMenuText( tr ("Change Mode of active Rx Channel") );
291
menubar->findItem( 0 )->setText( tr( "&File" ) );
292
menubar->findItem( 1 )->setText( tr( "&Settings" ) );
293
menubar->findItem( 2 )->setText( tr( "&RxParams" ) );
294
menubar->findItem( 4 )->setText( tr( "&Help" ) );
298
void LinPSK::fileOpen()
302
fileName = QFileDialog::getOpenFileName ( 0, tr ( "Open Demofile" ), "", settings.DemoModeFileType[settings.DemoTypeNumber] );
303
if ( !fileName.isEmpty() )
304
settings.inputFilename = fileName;
309
if ( settings.Status == ON ) // We arejust transmitting
311
QMessageBox::information ( 0, ProgramName,
312
"You should stop transmitting before closing this window!" );
317
if ( RxDisplay != 0 )
318
RxDisplay->stop_process_loop();
319
settings = *SaveParameters;
326
void LinPSK::helpIndex()
329
void LinPSK::helpContents()
332
void LinPSK::helpAbout()
336
void LinPSK::addRxWindow()
338
AddRxWindow *Channel = new AddRxWindow();
339
if ( Channel->exec() != 0 )
342
modus = RxDisplay->RxFreq->getAfcMode();
343
settings.ActChannel->setAfcMode ( modus );
344
Mode rxmode = ( Mode ) Channel->selectedMode();
345
if ( WindowColors.size() <= settings.RxChannels )
346
WindowColors << color[ ( settings.RxChannels*51 ) % 256];
348
RxDisplay->addRxWindow ( Channel->frequency(), rxmode, Channel->titleText() );
350
settings.ActChannel->setWindowColor ( WindowColors.at ( settings.RxChannels ) );
351
settings.RxChannels++;
352
RxDisplay->RxFreq->setAfcDisplayMode ( settings.ActChannel->AfcProperties() );
359
void LinPSK::calculateSizeofComponents()
361
/** Anteile in percent of mainwindow **/
367
#ifndef LINPSK_FOR_MAC
368
#define CONTROLPART 37
370
#define CONTROLPART 40
377
width = this->width();
378
height = this->height();
382
windowsheight = height * RXPART / 100;
383
if ( RxDisplay != 0 )
384
RxDisplay->setGeometry ( xpos, ypos, width, windowsheight );
386
ypos = ypos + windowsheight;
387
windowsheight = height * TXPART / 100;
388
if ( TxDisplay != 0 )
389
TxDisplay->setGeometry ( xpos, ypos, width, windowsheight );
390
ypos = ypos + windowsheight;
392
windowsheight = height * CONTROLPART / 100;
394
Control->setGeometry ( xpos, ypos, width, windowsheight );
399
void LinPSK::resizeEvent ( QResizeEvent * )
401
calculateSizeofComponents();
405
void LinPSK::setclock()
409
t = QDateTime::currentDateTime();
410
t = t.addSecs ( settings.timeoffset * 3600 );
411
s.sprintf ( " %2d:%2d UTC", t.time().hour(), t.time().minute() );
412
s.replace ( QRegExp ( ": " ), ":0" );
415
s = t.toString ( "dd.MM.yyyy" );
416
datum->setText ( s );
419
void LinPSK::setIMD ( float IMDvalue )
422
if ( IMDvalue != 0.0 )
423
s.sprintf ( " IMD = %6.2f dB", IMDvalue );
425
s.sprintf ( " IMD " );
428
void LinPSK::startRx()
430
if ( Modulator != 0 )
432
TxBuffer->insert ( TXOFF_CODE );
433
if ( Sound > 0 ) // Switch Trx to rx
434
while ( Sound->isRunning() ) // Wait for buffer to be cleared
435
qApp->processEvents ( QEventLoop::AllEvents, 100 );
437
if ( RxDisplay->start_process_loop() )
440
TxDisplay->TxFunctions->setStatus ( OFF );
441
if ( settings.ActChannel != 0 )
442
switch ( settings.ActChannel->getModulationType() )
465
msg->setText ( tr ( "Receiving " ) + Info );
468
TxDisplay->TxFunctions->setStatus ( UNDEF );
469
Control->Display->show();
470
settings.Status = TxDisplay->TxFunctions->getstatus();
471
TxDisplay->TxWindow->setFocus();
474
void LinPSK::startTx()
482
RxDisplay->stop_process_loop();
483
if ( settings.ActChannel == 0 )
485
QMessageBox::critical ( 0, " Program Error! LinPsk", "No active Channel available" );
486
TxDisplay->TxFunctions->setStatus ( UNDEF );
489
ModulationType = settings.ActChannel->getModulationType();
490
if ( TxDisplay->TxFreq->getAfcMode() != Off ) // net ?
491
TxDisplay->TxFreq->setFrequency ( settings.ActChannel->getRxFrequency() );
492
Frequency = TxDisplay->TxFreq->getFrequency();
493
switch ( ModulationType )
496
Modulator = new QPskModulator ( 11025, Frequency, TxBuffer );
500
Modulator = new BPSKModulator ( 11025, Frequency, TxBuffer );
505
Modulator = new RTTYModulator ( 11025, Frequency, TxBuffer );
506
if ( settings.ActChannel->getParameter ( Extra ) != 0 )
507
Modulator->setParameter ( Extra, settings.ActChannel->getParameter ( Extra ) );
511
Modulator = new MFSKModulator ( 11025, Frequency, TxBuffer );
516
Modulator = new BPSKModulator ( 11025, Frequency, TxBuffer );
520
if ( Sound <= 0 ) // Only create Sound Device once for output
522
if ( settings.DemoMode )
524
if ( settings.DemoTypeNumber == 0 )
525
Sound = new WaveInput ( -1 );
527
Sound = new TextInput ( -1 );
528
msg->setText ( tr ( "Transmitting (Demo)" ) );
531
Sound = new CSound ( settings.serial );
532
connect ( Sound, SIGNAL ( samplesAvailable() ), this, SLOT ( process_txdata() ) );
536
QMessageBox::critical ( 0, " Program Error! LinPsk", "Could not create Sound Device for Output" );
537
TxDisplay->TxFunctions->setStatus ( ON );
541
if ( Sound->open_Device_write ( &errorstring ) < 0 )
543
QMessageBox::information ( 0, ProgramName, errorstring );
548
connect ( Modulator, SIGNAL ( charSend ( char ) ), settings.ActChannel, SLOT ( updateRx ( char ) ) );
549
TxDisplay->TxFunctions->setStatus ( ON );
550
msg->setText ( tr ( "Transmitting " ) + Info );
551
TxDisplay->TxWindow->setFocus();
552
settings.Status = TxDisplay->TxFunctions->getstatus();
553
Control->Display->hide();
556
// process_txdata(); // Generate first Sample
561
void LinPSK::process_txdata()
564
// To avoid pending calls to process_txdata() after stopping tx
565
// when Modulator is alredy deleted
570
length = Modulator->CalcSignal ( Output, BUF_SIZE );
575
while ( length < BUF_SIZE )
576
Output[length++] = 0.0;
578
Txcount = Sound->putSamples ( Output, length );
586
Txcount = Sound->putSamples ( Output, length ); // If Txcount >= 0 and length < BUF_SIZE
587
// we've reached end of Transmiision
591
void LinPSK::generalSettings()
593
GeneralSettings *LocalSettings = new GeneralSettings ( this );
594
if ( LocalSettings->exec() != 0 )
595
settings = LocalSettings->getSettings();
598
void LinPSK::chooseColor()
600
int ID = settings.ActChannel->getID();
601
QColor color = QColorDialog::getColor ( WindowColors[ID], this );
602
if ( color.isValid() )
604
settings.ActChannel->setWindowColor ( color );
605
WindowColors[ID] = color;
606
RxDisplay->repaint();
607
RxDisplay->newColor();
611
void LinPSK::FontSetup()
614
QFont f = QFontDialog::getFont ( &ok, font(), this );
617
settings.ApplicationFont->setFamily ( f.family() );
618
int ii = f.pixelSize();
622
settings.ApplicationFont->setPointSize ( ii );
625
settings.ApplicationFont->setPixelSize ( ii );
630
void LinPSK::stopTx()
632
Modulator->disconnect();
635
Sound->PTT ( false );
636
Sound->close_Device();
642
void LinPSK::apply_settings()
646
void LinPSK::setChannelParams()
648
Control->Display->setPhasePointer ( settings.ActChannel->getPhasePointer() );
649
Control->QSO->newChannel();
650
if ( settings.ActChannel != 0 )
653
switch ( settings.ActChannel->getModulationType() )
674
RxDisplay->RxFreq->setAfcDisplayMode ( settings.ActChannel->AfcProperties() );
675
msg->setText ( tr ( "Receiving " ) + Info );
678
void LinPSK::setRxMode()
682
ExtraParameter *Param;
683
Param = ( ExtraParameter * ) settings.ActChannel->getParameter ( Extra );
685
Menu.setParameter ( *Param );
686
if ( Menu.exec() != 0 )
688
Mode rxmode = ( Mode ) Menu.selectedMode();
689
settings.ActChannel->setMode ( rxmode );
690
RxDisplay->RxFreq->setAfcDisplayMode ( settings.ActChannel->AfcProperties() );
691
RxDisplay->RxFreq->setAfcMode ( settings.ActChannel->getAfcMode() );
692
Control->Display->setPhasePointer ( settings.ActChannel->getPhasePointer() );
693
settings.ActChannel->setParameter ( Extra, &Menu.getParameter() );
695
if ( settings.ActChannel != 0 )
696
switch ( settings.ActChannel->getModulationType() )
718
msg->setText ( tr ( "Receiving " ) + Info );
721
void LinPSK::save_config()
724
QSettings config ( "DL1KSV", "LinPSK" );
725
/** Windows Parameter **/
726
config.beginGroup ( "WindowsParameter" );
727
// config.setValue ( "MinimumWindowWidth", settings.MinimumWindowWidth );
728
config.setValue ( "WindowWidth", width() );
729
// config.setValue ( "MinimumWindowHeight", settings.MinimumWindowHeight );
730
config.setValue ( "Xpos", this->x() );
731
config.setValue ( "Ypos", this->y() );
732
config.setValue ( "WindowHeight", height() );
733
config.setValue ( "FontName", qApp->font().family() );
734
config.setValue ( "FontSize", qApp->font().pointSize() );
737
config.setValue ( "DemoMode", settings.DemoMode );
738
config.setValue ( "DemoTypeNumber", settings.DemoTypeNumber );
740
config.setValue ( "Callsign", settings.callsign );
741
config.setValue ( "MyLocator", settings.myLocator );
743
config.setValue ( "PTTDevice", settings.SerialDevice );
745
config.setValue ( "Directory", settings.Directory );
746
config.setValue ( "QSoFileName", settings.QSOFileName );
747
config.setValue ( "FileLog", settings.fileLog );
748
config.setValue ( "LinLog", settings.LinLog );
749
if ( settings.LinLog )
751
config.setValue ( "Host", settings.Host );
752
config.setValue ( "Port", settings.Port );
755
config.setValue ( "TimeOffset", settings.timeoffset );
756
config.setValue ( "dateFormat", settings.dateFormat );
757
config.setValue ( "Slashed0", settings.slashed0 );
758
config.setValue ("autoCrLf",settings.autoCrLf);
760
if ( WindowColors.size() > 0 )
762
config.beginWriteArray ( "Colors" );
763
for ( i = 0; i < WindowColors.size();i++ )
765
config.setArrayIndex ( i );
766
config.setValue ( "r", WindowColors[i].red() );
767
config.setValue ( "g", WindowColors[i].green() );
768
config.setValue ( "b", WindowColors[i].blue() );
773
if ( ( Macro->count() > 0 ) )
775
config.beginWriteArray ( "Macros" );
776
for ( i = 0; i < Macro->count();i++ )
778
config.setArrayIndex ( i );
779
config.setValue ( "Name", Macro->getMacroName ( i ) );
780
QString s = Macro->getDefinition ( i );
781
config.setValue ( "Definition", s );
782
config.setValue ( "Accelerator", Macro->getAccelerator ( i ) );
789
void LinPSK::executeMacro ( int MacroNumber )
791
Macro->executeMacro ( MacroNumber, TxBuffer );
794
void LinPSK::addMacro()
797
AddMacro *NewMacro = new AddMacro ( Macro );
798
// NewMacro->setKeywords ( Macro );
799
if ( NewMacro->exec() != 0 )
801
Macro->insert ( NewMacro->macroName(),
802
NewMacro->macroDefinition(), NewMacro->accelerator(), NewMacro->position() );
803
Control->MacroBox->updateMacroWindow ( Macro );
806
void LinPSK::editMacro()
808
if ( Macro->count() > 0 )
810
EditMacro *Edit = new EditMacro ( Macro );
812
if ( Edit->exec() != 0 )
813
// Control->MacroBox->updateMacroWindow ( Macro );
814
Control->MacroBox->setMacroWindow ( Macro );
817
void LinPSK::deleteMacro()
819
if ( Macro->count() > 0 )
821
DeleteMacro *Del = new DeleteMacro ( Macro );
823
if ( Del->exec() != 0 )
824
Control->MacroBox->setMacroWindow ( Macro );
827
void LinPSK::renameMacro()
829
if ( Macro->count() > 0 )
831
RenameMacro *Ren = new RenameMacro ( Macro );
833
if ( Ren->exec() != 0 )
834
Control->MacroBox->setMacroWindow ( Macro );
838
void LinPSK::read_config()
840
QSettings config ( "DL1KSV", "LinPSK" );
847
// Try to read settings from Configfile
848
/** Windows Parameter **/
849
config.beginGroup ( "WindowsParameter" );
850
// settings.MinimumWindowWidth = config.value ( "MinimumWindowWidth" , 600 ).toInt();
851
WidthtoSet = config.value ( "WindowWidth" ).toInt();
852
// settings.MinimumWindowHeight = config.value ( "MinimumWindowHeight", 400 ).toInt();
853
X = config.value ( "Xpos" ).toInt();
854
Y = config.value ( "Ypos" ).toInt();
855
HeighttoSet = config.value ( "WindowHeight" ).toInt();
856
if ( config.contains ( "FontName" ) )
858
settings.ApplicationFont = new QFont ( config.value ( "FontName" ).toString() );
859
size = config.value ( "FontSize" ).toInt();
862
settings.ApplicationFont->setPointSize ( size );
867
settings.DemoMode = config.value ( "DemoMode" ).toBool();
868
settings.DemoTypeNumber = config.value ( "DemoTypeNumber" ).toInt();
870
settings.callsign = config.value ( "Callsign" ).toString();
871
settings.myLocator = config.value ( "MyLocator" ).toString();
873
settings.SerialDevice = config.value ( "PTTDevice" ).toString();
875
settings.Directory = config.value ( "Directory", QDir::homePath() ).toString();
877
settings.QSOFileName = config.value ( "QSoFileName" ).toString();
878
settings.fileLog = config.value ( "FileLog", true ).toBool();
879
settings.LinLog = config.value ( "LinLog", false ).toBool();
880
if ( settings.LinLog )
882
settings.Host = config.value ( "Host", "localhost" ).toString();
883
settings.Port = config.value ( "Port", 8080 ).toInt();
885
settings.timeoffset = config.value ( "TimeOffset" ).toInt();
886
settings.dateFormat = config.value ( "dateFormat", "dd.MM.yyyy" ).toString();
887
settings.slashed0 = config.value ( "Slashed0" ).toBool();
888
settings.autoCrLf = config.value("autoCrLf").toBool();
890
if ( config.contains ( "Colors" ) )
892
size = config.beginReadArray ( "Colors" );
893
for ( i = 0; i < size;i++ )
895
config.setArrayIndex ( i );
896
int r = config.value ( "r" ).toInt();
897
int g = config.value ( "g" ).toInt();
898
int b = config.value ( "b" ).toInt();
899
WindowColors.push_back ( QColor ( r, g, b ) );
905
size = config.beginReadArray ( "Macros" );
908
QString name, def, acc;
910
for ( i = 0; i < size;i++ )
912
config.setArrayIndex ( i );
913
name = config.value ( "Name" ).toString();
914
def = config.value ( "Definition" ).toString();
915
acc = config.value ( "Accelerator" ).toString();
916
Macro->insert ( name, def, acc, i + 1 );
921
if ( ( HeighttoSet > 0 ) && ( WidthtoSet > 0 ) )
922
resize ( WidthtoSet, HeighttoSet );
923
if ( ( X >= 0 ) && ( Y >= 0 ) )
927
void LinPSK::selectPTTDevice()
930
//if (settings.serial >0 )
931
// close(settings.serial);
932
settings.serial = -1;
933
if ( settings.SerialDevice != "None" )
935
// QMessageBox::information(0,"LinPsk","Trying to open Device " + settings.SerialDevice);
936
settings.serial = open ( settings.SerialDevice.toAscii().data(), O_EXCL | O_WRONLY );
937
// if (settings.serial > 0 )
938
// QMessageBox::information(0,"LinPsk","Opening successfull");
940
// QMessageBox::information(0,"LinPsk","Opening unsuccessfull");
942
int flags = TIOCM_RTS | TIOCM_DTR;
943
if ( settings.serial > 0 )
944
ioctl ( settings.serial, TIOCMBIC, &flags );
946
settings.SerialDevice = "None"; //Their seems to be a wrong Value in the ConfigFile
948
void LinPSK::recording ( bool on )
950
settings.ActChannel->record ( on );
952
void LinPSK::HelpAbout()
954
QMessageBox::about ( this, tr ( "About..." ),
955
ProgramName + QString ( VERSION ) + "\n written by Volker Schroer, DL1KSV\n" );
956
// setActiveWindow();
959
void LinPSK::saveSettings()
961
*SaveParameters = settings;
965
void LinPSK::closeEvent ( QCloseEvent *e )
967
if ( settings.Status != ON ) // We are not just transmitting
969
if ( RxDisplay != 0 )
970
RxDisplay->stop_process_loop();
976
QMessageBox::information ( 0, ProgramName,
977
"You should stop transmitting before closing this window!" );