Skip to content

Commit

Permalink
Merge pull request #3 from dl8dtl/macos_port
Browse files Browse the repository at this point in the history
MacOS port
  • Loading branch information
ON4QZ authored Oct 12, 2022
2 parents 33087aa + de8bc75 commit c5be1e3
Show file tree
Hide file tree
Showing 39 changed files with 254 additions and 107 deletions.
1 change: 0 additions & 1 deletion src/appdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ using namespace std; /* Because of the library: "complex" */
#undef DISABLENARROW

typedef double DSPFLOAT;
typedef unsigned char byte;


/* Define the application specific data-types ------------------------------- */
Expand Down
4 changes: 2 additions & 2 deletions src/config/operatorconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ QString onlineStatusText;
operatorConfig::operatorConfig(QWidget *parent) : baseConfig(parent), ui(new Ui::operatorConfig)
{
ui->setupUi(this);
QRegExp rx("^\\w*$");
QValidator *validator = new QRegExpValidator(rx, this);
QRegularExpression rx("^\\w*$");
QValidator *validator = new QRegularExpressionValidator(rx, this);
ui->onlineStatusText->setValidator(validator);
}

Expand Down
10 changes: 9 additions & 1 deletion src/config/soundconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
#include "ui_soundconfig.h"
#include "configparams.h"
#include "supportfunctions.h"
#include "soundalsa.h"
#ifdef __APPLE__
# include "soundbase.h"
#else
# include "soundalsa.h"
#endif

#include <QSettings>

Expand All @@ -49,7 +53,11 @@ soundConfig::soundConfig(QWidget *parent) : baseConfig(parent), ui(new Ui::soun
{
QStringList inputPCMList, outputPCMList;
ui->setupUi(this);
#ifdef __APPLE__
ui->alsaRadioButton->setCheckable(false);
#else
getCardList(inputPCMList, outputPCMList);
#endif
ui->inputPCMNameComboBox->addItems(inputPCMList);
ui->outputPCMNameComboBox->addItems(outputPCMList);
}
Expand Down
1 change: 0 additions & 1 deletion src/drmrx/channeldecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <stdlib.h>
#include <sys/types.h>
#include <math.h>
#include <malloc.h>
#include <float.h>
#include "drmproto.h"
#include "drmdefs.h"
Expand Down
1 change: 0 additions & 1 deletion src/drmrx/deinterleaver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
int *deinterleaver(int xinA, int tA, int xinB, int tB)
{
Expand Down
2 changes: 1 addition & 1 deletion src/drmrx/demodulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ bool demodulator::channelEstimation()
temp2 += actual_pilots[2 * j] * next_pilots[2 * j + 1] -actual_pilots[2 * j + 1] * next_pilots[2 * j];

}
if (i != 0) delta_freq_offset = (float) atan2(temp2, temp1 + MIN_ABS_H);
if (i != 0) delta_freq_offset = atan2f(temp2, temp1 + MIN_ABS_H);

for (j = 0; j < K_max - K_min + 1; j++)
{
Expand Down
1 change: 0 additions & 1 deletion src/drmrx/getmode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
#include <malloc.h>
#include "structtemplates.h"
#include "drmproto.h"
#include "drmdefs.h"
Expand Down
1 change: 0 additions & 1 deletion src/drmrx/mkfacmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
int mkfacmap(int robustness_mode, int K_dc, int K_modulo, int /*@out@ */ *FACmap)
{
int elem_cnt, i;
Expand Down
1 change: 0 additions & 1 deletion src/drmrx/mkmscmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <stdlib.h>
#include <sys/types.h>
#include <math.h>
#include <malloc.h>
#include "drmdefs.h"
#include "structtemplates.h"
#include "drmproto.h"
Expand Down
1 change: 0 additions & 1 deletion src/drmrx/psdcmean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
#include <malloc.h>
void cfft(float *, int, int);
void psdcmean(float *rsbuf, float *cpsd, int lblock, int nblocks)
{
Expand Down
1 change: 0 additions & 1 deletion src/drmrx/psdmean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
#include <malloc.h>
void rfft(float *, int, int);
void psdmean(float *input, float *psd, int lblock, int nblocks)
{
Expand Down
2 changes: 0 additions & 2 deletions src/drmrx/sourcedecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ void sourceDecoder::writeData(transportBlock *tbPtr)

QByteArray ba;

int length=0;
erasureList.clear();
erasureList.append(tbPtr->totalSegments);
erasureList.append(tbPtr->defaultSegmentSize);
Expand All @@ -478,7 +477,6 @@ void sourceDecoder::writeData(transportBlock *tbPtr)
{
ba.append(tbPtr->dataSegmentPtrList.at(i)->data);
}
length+=tbPtr->dataSegmentPtrList.at(i)->data.size();
}
tbPtr->segmentsReceived=0;
drmBlockList.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*
\******************************************************************************/

#include "DrmTransmitter.h"
#include "CDrmTransmitter.h"
#include "csoundout.h"
#include "appglobal.h"
#include "drm.h"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/drmtx/drmtransmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define DRMTRANSMITTER_H

#include "common/GlobalDefinitions.h"
#include "common/DrmTransmitter.h"
#include "common/CDrmTransmitter.h"
#include "drmparams.h"


Expand Down
2 changes: 1 addition & 1 deletion src/editor/basegraphicitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ enum egraphType {BASE=QGraphicsItem::UserType+1,RECTANGLE,ELLIPSE,IMAGE,LINE,TEX
param.rct=QRectF(x,y,width,height);
param.modified=true;
}
int type() { return param.type;}
int type() const { return param.type;}
sitemParam *getParamPtr() {return &param;}
bool markedForDeletion;

Expand Down
17 changes: 9 additions & 8 deletions src/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,17 @@ void editor::slotFileNew()
if(ev->isModified())
{
switch( QMessageBox::information( this, "Editor",
"The document has not been saved as a template\n",
"&Continue Anyway","Cancel",NULL,
-1, // Enter == button 0
1 ) )
{ // Escape == button 2
case 0: // Continu clicked
"The document has not been saved as a template.\n"
"Discard changes, or cancel \"New file\" action?",
QMessageBox::Cancel | QMessageBox::Discard,
QMessageBox::Cancel) )
{
case QMessageBox::Discard:
break;
case 1: // Cancel clicked
case QMessageBox::Cancel:
return;
default: // cannot happen ;-)
return;
break;
}
}
ev->slotClearAll();
Expand Down
25 changes: 25 additions & 0 deletions src/editor/editorview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,31 @@ editorView::editorView(QWidget *parent):QWidget(parent), Ui::editorForm()
connect(dumpPushButton,SIGNAL(clicked()),SLOT(slotDump()));
#endif

#if defined(__APPLE__) && QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
// workaround for performance issue on MacOS 12.x
// idea courtesy
// https://stackoverflow.com/questions/69890284/qslider-in-qt-misbehaves-in-new-macos-monterey-v12-0-1-any-workaround
const QString stylesheet("\
QSlider::groove:horizontal {\
height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ \
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);\
margin: 2px 0;\
}\
\
QSlider::handle:horizontal {\
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);\
border: 1px solid #5c5c5c;\
width: 18px;\
margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ \
border-radius: 3px;\
}\
");
hshearSlider->setStyleSheet(stylesheet);
vshearSlider->setStyleSheet(stylesheet);


#endif // __APPLE__ && Qt < 6.3

modified=false;
}

Expand Down
6 changes: 3 additions & 3 deletions src/mainwidgets/txfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,12 @@ void txFunctions:: sendFSKID()
{
sendFSKChar(IDChar);
idx++;
QChar IDText=QChar(myCallsign[idx].toUpper());
IDChar=int(IDText.toLatin1());
IDChar = (IDChar - 0x20);

if (idx < l)
{
QChar IDText=QChar(myCallsign[idx].toUpper());
IDChar=int(IDText.toLatin1());
IDChar = (IDChar - 0x20);
Checksum = Checksum ^ IDChar;
}
}
Expand Down
25 changes: 24 additions & 1 deletion src/mainwidgets/txwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,26 @@ txWidget::txWidget(QWidget *parent) : QWidget(parent), ui(new Ui::txWidget)
notifyTimer.setInterval(NOTIFYCHECKINTERVAL);
repeaterTxDelayTimer.setSingleShot(true);

#if defined(__APPLE__) && QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
// workaround for performance issue on MacOS 12.x
// idea courtesy
// https://stackoverflow.com/questions/69890284/qslider-in-qt-misbehaves-in-new-macos-monterey-v12-0-1-any-workaround
ui->sizeSlider->setStyleSheet("\
QSlider::groove:horizontal {\
height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ \
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);\
margin: 2px 0;\
}\
\
QSlider::handle:horizontal {\
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);\
border: 1px solid #5c5c5c;\
width: 18px;\
margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ \
border-radius: 3px;\
}\
");
#endif // __APPLE__ && Qt < 6.3
}

txWidget::~txWidget()
Expand Down Expand Up @@ -380,8 +400,9 @@ void txWidget::startTxImage()
addToLog("invalidImage",LOGTXMAIN);
return;
}
QFileInfo finf=imageViewerPtr->getFilename();
QString fn;
fn=imageViewerPtr->getFilename();
QFileInfo finf(fn);

switch(transmissionModeIndex)
{
Expand Down Expand Up @@ -635,6 +656,7 @@ void txWidget::slotResizeChanged(int i)

void txWidget::slotSnapshot()
{
#ifndef __APPLE__
QImage *im;
cameraDialog camera;
if(camera.exec()==QDialog::Accepted)
Expand All @@ -650,6 +672,7 @@ void txWidget::slotSnapshot()
galleryWidgetPtr->txStockImageChanged();
}
}
#endif // __APPLE__
}


Expand Down
18 changes: 15 additions & 3 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include "dispatch/dispatcher.h"
#include "ui_mainwindow.h"
#include "soundpulse.h"
#include "soundalsa.h"
#ifndef __APPLE__
# include "soundalsa.h"
#endif
#include "configdialog.h"
#include "configparams.h"
#include "rigcontrol.h"
Expand Down Expand Up @@ -112,8 +114,13 @@ mainWindow::mainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainW
txWidgetPtr=ui->txWindow;
galleryWidgetPtr=ui->galleryWindow;
readSettings();
if(pulseSelected) soundIOPtr=new soundPulse;
#ifndef __APPLE__
if(pulseSelected)
#endif
soundIOPtr=new soundPulse;
#ifndef __APPLE__
else soundIOPtr=new soundAlsa;
#endif
dispatcherPtr=new dispatcher;
waterfallPtr=new waterfallText;
xmlIntfPtr=new xmlInterface;
Expand Down Expand Up @@ -222,8 +229,13 @@ void mainWindow::restartSound(bool inStartUp)
delete soundIOPtr;
soundIOPtr=nullptr;
}
if(pulseSelected) soundIOPtr=new soundPulse;
#ifndef __APPLE__
if(pulseSelected)
#endif
soundIOPtr=new soundPulse;
#ifndef __APPLE__
else soundIOPtr=new soundAlsa;
#endif
if(!soundIOPtr->init(BASESAMPLERATE))
{
if(inStartUp)
Expand Down
Loading

0 comments on commit c5be1e3

Please sign in to comment.