Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
chain78
qtcpp_demo
提交
d8c70031
qtcpp_demo
项目概览
chain78
/
qtcpp_demo
与 Fork 源项目一致
Fork自
colorEagleStdio / qtcpp_demo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
qtcpp_demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d8c70031
编写于
2月 06, 2021
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Qt6 deprecated issues.
上级
fb12c783
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
1633 addition
and
1624 deletion
+1633
-1624
uhd_cpp/uhd_spectrum/qtgui/bookmarks.cpp
uhd_cpp/uhd_spectrum/qtgui/bookmarks.cpp
+239
-239
uhd_cpp/uhd_spectrum/qtgui/bookmarkstablemodel.cpp
uhd_cpp/uhd_spectrum/qtgui/bookmarkstablemodel.cpp
+151
-151
uhd_cpp/uhd_spectrum/qtgui/bookmarkstaglist.cpp
uhd_cpp/uhd_spectrum/qtgui/bookmarkstaglist.cpp
+218
-218
uhd_cpp/uhd_spectrum/qtgui/freqctrl.cpp
uhd_cpp/uhd_spectrum/qtgui/freqctrl.cpp
+653
-645
uhd_cpp/uhd_spectrum/qtgui/freqctrl.h
uhd_cpp/uhd_spectrum/qtgui/freqctrl.h
+109
-108
uhd_cpp/uhd_spectrum/qtgui/plotter.cpp
uhd_cpp/uhd_spectrum/qtgui/plotter.cpp
+14
-14
uhd_cpp/uhd_spectrum/uhd_device_win32.cpp
uhd_cpp/uhd_spectrum/uhd_device_win32.cpp
+249
-249
未找到文件。
uhd_cpp/uhd_spectrum/qtgui/bookmarks.cpp
浏览文件 @
d8c70031
/* -*- c++ -*- */
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
...
...
@@ -30,7 +30,7 @@
#include "bookmarks.h"
#include <stdio.h>
#include <wchar.h>
#include <algorithm>
const
QColor
TagInfo
::
DefaultColor
(
Qt
::
lightGray
);
const
QString
TagInfo
::
strUntagged
(
"Untagged"
);
Bookmarks
*
Bookmarks
::
m_pThis
=
0
;
...
...
@@ -155,7 +155,7 @@ bool Bookmarks::save()
QTextStream
stream
(
&
file
);
stream
<<
QString
(
"# Tag name"
).
leftJustified
(
20
)
+
"; "
+
QString
(
" color"
)
<<
endl
;
QString
(
" color"
)
<<
Qt
::
endl
;
QSet
<
TagInfo
*>
usedTags
;
for
(
int
iBookmark
=
0
;
iBookmark
<
m_BookmarkList
.
size
();
iBookmark
++
)
...
...
@@ -171,16 +171,16 @@ bool Bookmarks::save()
for
(
QSet
<
TagInfo
*>::
iterator
i
=
usedTags
.
begin
();
i
!=
usedTags
.
end
();
i
++
)
{
TagInfo
&
info
=
**
i
;
stream
<<
info
.
name
.
leftJustified
(
20
)
+
"; "
+
info
.
color
.
name
()
<<
endl
;
stream
<<
info
.
name
.
leftJustified
(
20
)
+
"; "
+
info
.
color
.
name
()
<<
Qt
::
endl
;
}
stream
<<
endl
;
stream
<<
Qt
::
endl
;
stream
<<
QString
(
"# Frequency"
).
leftJustified
(
12
)
+
"; "
+
QString
(
"Name"
).
leftJustified
(
25
)
+
"; "
+
QString
(
"Modulation"
).
leftJustified
(
20
)
+
"; "
+
QString
(
"Bandwidth"
).
rightJustified
(
10
)
+
"; "
+
QString
(
"Tags"
)
<<
endl
;
QString
(
"Tags"
)
<<
Qt
::
endl
;
for
(
int
i
=
0
;
i
<
m_BookmarkList
.
size
();
i
++
)
{
...
...
@@ -199,7 +199,7 @@ bool Bookmarks::save()
line
.
append
(
tag
.
name
);
}
stream
<<
line
<<
endl
;
stream
<<
line
<<
Qt
::
endl
;
}
file
.
close
();
...
...
@@ -212,9 +212,9 @@ QList<BookmarkInfo> Bookmarks::getBookmarksInRange(qint64 low, qint64 high)
{
BookmarkInfo
info
;
info
.
frequency
=
low
;
QList
<
BookmarkInfo
>::
const_iterator
lb
=
qLowerBound
(
m_BookmarkList
,
info
);
QList
<
BookmarkInfo
>::
const_iterator
lb
=
std
::
lower_bound
(
m_BookmarkList
.
begin
(),
m_BookmarkList
.
end
(),
info
);
info
.
frequency
=
high
;
QList
<
BookmarkInfo
>::
const_iterator
ub
=
qUpperBound
(
m_BookmarkList
,
info
);
QList
<
BookmarkInfo
>::
const_iterator
ub
=
std
::
upper_bound
(
m_BookmarkList
.
begin
(),
m_BookmarkList
.
end
(),
info
);
QList
<
BookmarkInfo
>
found
;
...
...
uhd_cpp/uhd_spectrum/qtgui/bookmarkstablemodel.cpp
浏览文件 @
d8c70031
/* -*- c++ -*- */
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
...
...
@@ -74,7 +74,7 @@ QVariant BookmarksTableModel::data ( const QModelIndex & index, int role ) const
{
BookmarkInfo
&
info
=
*
m_Bookmarks
[
index
.
row
()];
if
(
role
==
Qt
::
BackgroundColor
Role
)
if
(
role
==
Qt
::
Background
Role
)
{
QColor
bg
(
info
.
GetColor
());
bg
.
setAlpha
(
0x60
);
...
...
@@ -160,7 +160,7 @@ bool BookmarksTableModel::setData(const QModelIndex &index, const QVariant &valu
Qt
::
ItemFlags
BookmarksTableModel
::
flags
(
const
QModelIndex
&
index
)
const
{
Qt
::
ItemFlags
flags
=
0
;
Qt
::
ItemFlags
flags
=
Qt
::
NoItemFlags
;
switch
(
index
.
column
())
{
...
...
uhd_cpp/uhd_spectrum/qtgui/bookmarkstaglist.cpp
浏览文件 @
d8c70031
/* -*- c++ -*- */
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
...
...
@@ -269,7 +269,7 @@ void BookmarksTagList::AddTag(QString name, Qt::CheckState checkstate, QColor co
// Column 0
item
=
new
QTableWidgetItem
();
item
->
setFlags
(
Qt
::
ItemIsEnabled
);
item
->
setBackgroundColor
(
color
);
item
->
setBackground
(
color
);
setItem
(
i
,
0
,
item
);
}
...
...
uhd_cpp/uhd_spectrum/qtgui/freqctrl.cpp
浏览文件 @
d8c70031
/*
/*
* Frequency controller widget (originally from CuteSDR)
*
* This file is part of gqrx sdr.
...
...
@@ -93,6 +93,14 @@ bool CFreqCtrl::inRect(QRect &rect, QPoint &point)
else
return
false
;
}
bool
CFreqCtrl
::
inRect
(
QRect
&
rect
,
QPointF
&
point
)
{
if
((
point
.
x
()
<
rect
.
right
())
&&
(
point
.
x
()
>
rect
.
x
())
&&
(
point
.
y
()
<
rect
.
bottom
())
&&
(
point
.
y
()
>
rect
.
y
()))
return
true
;
else
return
false
;
}
static
int
fmax_to_numdigits
(
qint64
fmax
)
{
...
...
@@ -463,8 +471,8 @@ void CFreqCtrl::mousePressEvent(QMouseEvent *event)
void
CFreqCtrl
::
wheelEvent
(
QWheelEvent
*
event
)
{
QPoint
pt
=
event
->
pos
();
int
numDegrees
=
event
->
delta
(
)
/
8
;
QPointF
pt
=
event
->
position
();
int
numDegrees
=
(
event
->
angleDelta
().
x
()
+
event
->
angleDelta
().
y
()
)
/
8
;
int
numSteps
=
numDegrees
/
15
;
for
(
int
i
=
m_DigStart
;
i
<
m_NumDigits
;
i
++
)
...
...
uhd_cpp/uhd_spectrum/qtgui/freqctrl.h
浏览文件 @
d8c70031
/*
/*
* Frequency controller widget (originally from CuteSDR)
*/
#pragma once
...
...
@@ -80,6 +80,7 @@ private:
void
moveCursorLeft
();
void
moveCursorRight
();
bool
inRect
(
QRect
&
rect
,
QPoint
&
point
);
bool
inRect
(
QRect
&
rect
,
QPointF
&
point
);
bool
m_UpdateAll
;
bool
m_ExternalKeyActive
;
...
...
uhd_cpp/uhd_spectrum/qtgui/plotter.cpp
浏览文件 @
d8c70031
...
...
@@ -404,13 +404,13 @@ void CPlotter::mouseMoveEvent(QMouseEvent* event)
}
else
if
(
XAXIS
==
m_CursorCaptured
)
{
if
(
event
->
buttons
()
&
(
Qt
::
LeftButton
|
Qt
::
MidButton
))
if
(
event
->
buttons
()
&
(
Qt
::
LeftButton
|
Qt
::
Mid
dle
Button
))
{
setCursor
(
QCursor
(
Qt
::
ClosedHandCursor
));
// pan viewable range or move center frequency
int
delta_px
=
m_Xzero
-
pt
.
x
();
qint64
delta_hz
=
delta_px
*
m_Span
/
m_OverlayPixmap
.
width
();
if
(
event
->
buttons
()
&
Qt
::
MidButton
)
if
(
event
->
buttons
()
&
Qt
::
Mid
dle
Button
)
{
m_CenterFreq
+=
delta_hz
;
m_DemodCenterFreq
+=
delta_hz
;
...
...
@@ -709,7 +709,7 @@ void CPlotter::mousePressEvent(QMouseEvent * event)
m_GrabPosition
=
1
;
drawOverlay
();
}
else
if
(
event
->
buttons
()
==
Qt
::
MidButton
)
else
if
(
event
->
buttons
()
==
Qt
::
Mid
dle
Button
)
{
// set center freq
m_CenterFreq
=
roundFreq
(
freqFromX
(
pt
.
x
()),
m_ClickResolution
);
...
...
@@ -827,10 +827,10 @@ void CPlotter::zoomOnXAxis(double level)
// Called when a mouse wheel is turned
void
CPlotter
::
wheelEvent
(
QWheelEvent
*
event
)
{
QPoint
pt
=
event
->
pos
();
QPoint
F
pt
=
event
->
position
();
pt
.
setX
(
pt
.
x
()
/
pixRatio
()
+
.5
);
pt
.
setY
(
pt
.
y
()
/
pixRatio
()
+
.5
);
int
numDegrees
=
event
->
delta
(
)
/
8
;
int
numDegrees
=
(
event
->
angleDelta
().
x
()
+
event
->
angleDelta
().
y
()
)
/
8
;
int
numSteps
=
numDegrees
/
15
;
/** FIXME: Only used for direction **/
/** FIXME: zooming could use some optimisation **/
...
...
@@ -838,7 +838,7 @@ void CPlotter::wheelEvent(QWheelEvent * event)
{
// Vertical zoom. Wheel down: zoom out, wheel up: zoom in
// During zoom we try to keep the point (dB or kHz) under the cursor fixed
double
zoom_fac
=
event
->
delta
()
<
0
?
1.1
:
0.9
;
double
zoom_fac
=
numDegrees
<
0
?
1.1
:
0.9
;
double
ratio
=
(
double
)
pt
.
y
()
/
(
double
)
m_OverlayPixmap
.
height
();
double
db_range
=
m_PandMaxdB
-
m_PandMindB
;
double
y_range
=
(
double
)
m_OverlayPixmap
.
height
();
...
...
@@ -857,7 +857,7 @@ void CPlotter::wheelEvent(QWheelEvent * event)
}
else
if
(
m_CursorCaptured
==
XAXIS
)
{
zoomStepX
(
event
->
delta
()
<
0
?
1.1
:
0.9
,
pt
.
x
());
zoomStepX
(
numDegrees
<
0
?
1.1
:
0.9
,
pt
.
x
());
}
else
if
(
event
->
modifiers
()
&
Qt
::
ControlModifier
)
{
...
...
@@ -1351,7 +1351,7 @@ void CPlotter::drawOverlay()
QFontMetrics
metrics
(
m_Font
);
QPainter
painter
(
&
m_OverlayPixmap
);
painter
.
initFrom
(
this
);
painter
.
begin
(
this
);
painter
.
setFont
(
m_Font
);
// solid background
...
...
@@ -1362,7 +1362,7 @@ void CPlotter::drawOverlay()
#define VER_MARGIN 5
// X and Y axis areas
m_YAxisWidth
=
metrics
.
width
(
"XXXX"
)
+
2
*
HOR_MARGIN
;
m_YAxisWidth
=
metrics
.
horizontalAdvance
(
"XXXX"
)
+
2
*
HOR_MARGIN
;
m_XAxisYCenter
=
h
-
metrics
.
height
()
/
2
;
int
xAxisHeight
=
metrics
.
height
()
+
2
*
VER_MARGIN
;
int
xAxisTop
=
h
-
xAxisHeight
;
...
...
@@ -1384,7 +1384,7 @@ void CPlotter::drawOverlay()
x
=
xFromFreq
(
bookmarks
[
i
].
frequency
);
#if defined(_WIN16) || defined(_WIN32) || defined(_WIN64)
int
nameWidth
=
fm
.
width
(
bookmarks
[
i
].
name
);
int
nameWidth
=
fm
.
horizontalAdvance
(
bookmarks
[
i
].
name
);
#else
int
nameWidth
=
fm
.
boundingRect
(
bookmarks
[
i
].
name
).
width
();
#endif
...
...
@@ -1397,7 +1397,7 @@ void CPlotter::drawOverlay()
level
=
0
;
tagEnd
[
level
]
=
x
+
nameWidth
+
slant
-
1
;
m_BookmarkTags
.
append
(
qMakePair
<
QRect
,
qint64
>
(
QRect
(
x
,
level
*
levelHeight
,
nameWidth
+
slant
,
fontHeight
),
bookmarks
[
i
].
frequency
));
m_BookmarkTags
.
append
(
qMakePair
(
QRect
(
x
,
level
*
levelHeight
,
nameWidth
+
slant
,
fontHeight
),
bookmarks
[
i
].
frequency
));
QColor
color
=
QColor
(
bookmarks
[
i
].
GetColor
());
color
.
setAlpha
(
0x60
);
...
...
@@ -1437,7 +1437,7 @@ void CPlotter::drawOverlay()
QString
label
;
label
.
setNum
(
double
((
StartFreq
+
m_Span
)
/
m_FreqUnits
),
'f'
,
m_FreqDigits
);
calcDivSize
(
StartFreq
,
StartFreq
+
m_Span
,
qMin
(
w
/
(
metrics
.
width
(
label
)
+
metrics
.
width
(
"O"
)),
HORZ_DIVS_MAX
),
qMin
(
w
/
(
metrics
.
horizontalAdvance
(
label
)
+
metrics
.
horizontalAdvance
(
"O"
)),
HORZ_DIVS_MAX
),
m_StartFreqAdj
,
m_FreqPerDiv
,
m_HorDivs
);
pixperdiv
=
(
double
)
w
*
(
double
)
m_FreqPerDiv
/
(
double
)
m_Span
;
adjoffset
=
pixperdiv
*
double
(
m_StartFreqAdj
-
StartFreq
)
/
(
double
)
m_FreqPerDiv
;
...
...
@@ -1455,7 +1455,7 @@ void CPlotter::drawOverlay()
painter
.
setPen
(
QColor
(
PLOTTER_TEXT_COLOR
));
for
(
int
i
=
0
;
i
<=
m_HorDivs
;
i
++
)
{
int
tw
=
metrics
.
width
(
m_HDivText
[
i
]);
int
tw
=
metrics
.
horizontalAdvance
(
m_HDivText
[
i
]);
x
=
(
int
)((
double
)
i
*
pixperdiv
+
adjoffset
);
if
(
x
>
m_YAxisWidth
)
{
...
...
@@ -1494,7 +1494,7 @@ void CPlotter::drawOverlay()
// draw amplitude values (y axis)
int
dB
=
m_PandMaxdB
;
m_YAxisWidth
=
metrics
.
width
(
"-120 "
);
m_YAxisWidth
=
metrics
.
horizontalAdvance
(
"-120 "
);
painter
.
setPen
(
QColor
(
PLOTTER_TEXT_COLOR
));
for
(
int
i
=
0
;
i
<
m_VerDivs
;
i
++
)
{
...
...
uhd_cpp/uhd_spectrum/uhd_device_win32.cpp
浏览文件 @
d8c70031
#include "uhd_device_win32.h"
#
include
"uhd_device_win32.h"
#include <QThread>
#include <QDebug>
#include <QCoreApplication>
...
...
@@ -262,8 +262,8 @@ quint64 uhd_device::set_center_freq(const quint64 freq_in_hz)
/*.target_freq =*/
(
double
)
freq_in_hz
,
/*.rf_freq_policy =*/
UHD_TUNE_REQUEST_POLICY_AUTO
,
/*.rf_freq =*/
0
,
/*.dsp_freq_policy = */
UHD_TUNE_REQUEST_POLICY_
MANUAL
,
/*.dsp_freq =*/
srate
/
2
,
/*.dsp_freq_policy = */
UHD_TUNE_REQUEST_POLICY_
AUTO
,
/*.dsp_freq =*/
0
,
/*.args =*/
0
};
UHD_DO
(
uhd_usrp_set_rx_freq
(
usrp
,
&
rx_tune_request
,
m_channel
,
&
rx_tune_result
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录