提交 7c84263a 编写于 作者: M manjaro

迁移uhd spectrum到独立版本库

上级 6d9df4bc
文件已添加
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* The following statement of license applies *only* to this header file,
* and *not* to the other files distributed with FFTW or derived therefrom:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/***************************** NOTE TO USERS *********************************
*
* THIS IS A HEADER FILE, NOT A MANUAL
*
* If you want to know how to use FFTW, please read the manual,
* online at http://www.fftw.org/doc/ and also included with FFTW.
* For a quick start, see the manual's tutorial section.
*
* (Reading header files to learn how to use a library is a habit
* stemming from code lacking a proper manual. Arguably, it's a
* *bad* habit in most cases, because header files can contain
* interfaces that are not part of the public, stable API.)
*
****************************************************************************/
#ifndef FFTW3_H
#define FFTW3_H
#include <stdio.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* If <complex.h> is included, use the C99 complex type. Otherwise
define a type bit-compatible with C99 complex */
#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C
#else
# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2]
#endif
#define FFTW_CONCAT(prefix, name) prefix ## name
#define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name)
#define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name)
#define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name)
#define FFTW_MANGLE_QUAD(name) FFTW_CONCAT(fftwq_, name)
/* IMPORTANT: for Windows compilers, you should add a line
*/
#define FFTW_DLL
/*
here and in kernel/ifftw.h if you are compiling/using FFTW as a
DLL, in order to do the proper importing/exporting, or
alternatively compile with -DFFTW_DLL or the equivalent
command-line flag. This is not necessary under MinGW/Cygwin, where
libtool does the imports/exports automatically. */
#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__))
/* annoying Windows syntax for shared-library declarations */
# if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */
# define FFTW_EXTERN extern __declspec(dllexport)
# else /* user is calling FFTW; import symbol */
# define FFTW_EXTERN extern __declspec(dllimport)
# endif
#else
# define FFTW_EXTERN extern
#endif
enum fftw_r2r_kind_do_not_use_me {
FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
};
struct fftw_iodim_do_not_use_me {
int n; /* dimension size */
int is; /* input stride */
int os; /* output stride */
};
#include <stddef.h> /* for ptrdiff_t */
struct fftw_iodim64_do_not_use_me {
ptrdiff_t n; /* dimension size */
ptrdiff_t is; /* input stride */
ptrdiff_t os; /* output stride */
};
typedef void (*fftw_write_char_func_do_not_use_me)(char c, void *);
typedef int (*fftw_read_char_func_do_not_use_me)(void *);
/*
huge second-order macro that defines prototypes for all API
functions. We expand this macro for each supported precision
X: name-mangling macro
R: real data type
C: complex data type
*/
#define FFTW_DEFINE_API(X, R, C) \
\
FFTW_DEFINE_COMPLEX(R, C); \
\
typedef struct X(plan_s) *X(plan); \
\
typedef struct fftw_iodim_do_not_use_me X(iodim); \
typedef struct fftw_iodim64_do_not_use_me X(iodim64); \
\
typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \
\
typedef fftw_write_char_func_do_not_use_me X(write_char_func); \
typedef fftw_read_char_func_do_not_use_me X(read_char_func); \
\
FFTW_EXTERN void X(execute)(const X(plan) p); \
\
FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n, \
C *in, C *out, int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_2d)(int n0, int n1, \
C *in, C *out, int sign, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_3d)(int n0, int n1, int n2, \
C *in, C *out, int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_many_dft)(int rank, const int *n, \
int howmany, \
C *in, const int *inembed, \
int istride, int idist, \
C *out, const int *onembed, \
int ostride, int odist, \
int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
C *in, C *out, \
int sign, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *ri, R *ii, R *ro, R *io, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_dft)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
C *in, C *out, \
int sign, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru64_split_dft)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *ri, R *ii, R *ro, R *io, \
unsigned flags); \
\
FFTW_EXTERN void X(execute_dft)(const X(plan) p, C *in, C *out); \
FFTW_EXTERN void X(execute_split_dft)(const X(plan) p, R *ri, R *ii, \
R *ro, R *io); \
\
FFTW_EXTERN X(plan) X(plan_many_dft_r2c)(int rank, const int *n, \
int howmany, \
R *in, const int *inembed, \
int istride, int idist, \
C *out, const int *onembed, \
int ostride, int odist, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_r2c)(int rank, const int *n, \
R *in, C *out, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_r2c_2d)(int n0, int n1, \
R *in, C *out, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_r2c_3d)(int n0, int n1, \
int n2, \
R *in, C *out, unsigned flags); \
\
\
FFTW_EXTERN X(plan) X(plan_many_dft_c2r)(int rank, const int *n, \
int howmany, \
C *in, const int *inembed, \
int istride, int idist, \
R *out, const int *onembed, \
int ostride, int odist, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_c2r)(int rank, const int *n, \
C *in, R *out, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_c2r_2d)(int n0, int n1, \
C *in, R *out, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_c2r_3d)(int n0, int n1, \
int n2, \
C *in, R *out, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, C *out, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
C *in, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_split_dft_r2c)( \
int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, R *ro, R *io, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru_split_dft_c2r)( \
int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *ri, R *ii, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_dft_r2c)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, C *out, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru64_dft_c2r)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
C *in, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_split_dft_r2c)( \
int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, R *ro, R *io, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru64_split_dft_c2r)( \
int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *ri, R *ii, R *out, \
unsigned flags); \
\
FFTW_EXTERN void X(execute_dft_r2c)(const X(plan) p, R *in, C *out); \
FFTW_EXTERN void X(execute_dft_c2r)(const X(plan) p, C *in, R *out); \
\
FFTW_EXTERN void X(execute_split_dft_r2c)(const X(plan) p, \
R *in, R *ro, R *io); \
FFTW_EXTERN void X(execute_split_dft_c2r)(const X(plan) p, \
R *ri, R *ii, R *out); \
\
FFTW_EXTERN X(plan) X(plan_many_r2r)(int rank, const int *n, \
int howmany, \
R *in, const int *inembed, \
int istride, int idist, \
R *out, const int *onembed, \
int ostride, int odist, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_r2r_1d)(int n, R *in, R *out, \
X(r2r_kind) kind, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_r2r_2d)(int n0, int n1, R *in, R *out, \
X(r2r_kind) kind0, X(r2r_kind) kind1, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_r2r_3d)(int n0, int n1, int n2, \
R *in, R *out, X(r2r_kind) kind0, \
X(r2r_kind) kind1, X(r2r_kind) kind2, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_r2r)(int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN void X(execute_r2r)(const X(plan) p, R *in, R *out); \
\
FFTW_EXTERN void X(destroy_plan)(X(plan) p); \
FFTW_EXTERN void X(forget_wisdom)(void); \
FFTW_EXTERN void X(cleanup)(void); \
\
FFTW_EXTERN void X(set_timelimit)(double t); \
\
FFTW_EXTERN void X(plan_with_nthreads)(int nthreads); \
FFTW_EXTERN int X(init_threads)(void); \
FFTW_EXTERN void X(cleanup_threads)(void); \
FFTW_EXTERN void X(make_planner_thread_safe)(void); \
\
FFTW_EXTERN int X(export_wisdom_to_filename)(const char *filename); \
FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file); \
FFTW_EXTERN char *X(export_wisdom_to_string)(void); \
FFTW_EXTERN void X(export_wisdom)(X(write_char_func) write_char, \
void *data); \
FFTW_EXTERN int X(import_system_wisdom)(void); \
FFTW_EXTERN int X(import_wisdom_from_filename)(const char *filename); \
FFTW_EXTERN int X(import_wisdom_from_file)(FILE *input_file); \
FFTW_EXTERN int X(import_wisdom_from_string)(const char *input_string); \
FFTW_EXTERN int X(import_wisdom)(X(read_char_func) read_char, void *data); \
\
FFTW_EXTERN void X(fprint_plan)(const X(plan) p, FILE *output_file); \
FFTW_EXTERN void X(print_plan)(const X(plan) p); \
FFTW_EXTERN char *X(sprint_plan)(const X(plan) p); \
\
FFTW_EXTERN void *X(malloc)(size_t n); \
FFTW_EXTERN R *X(alloc_real)(size_t n); \
FFTW_EXTERN C *X(alloc_complex)(size_t n); \
FFTW_EXTERN void X(free)(void *p); \
\
FFTW_EXTERN void X(flops)(const X(plan) p, \
double *add, double *mul, double *fmas); \
FFTW_EXTERN double X(estimate_cost)(const X(plan) p); \
FFTW_EXTERN double X(cost)(const X(plan) p); \
\
FFTW_EXTERN int X(alignment_of)(R *p); \
FFTW_EXTERN const char X(version)[]; \
FFTW_EXTERN const char X(cc)[]; \
FFTW_EXTERN const char X(codelet_optim)[];
/* end of FFTW_DEFINE_API macro */
FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex)
FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex)
FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64
for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \
&& !(defined(__ICC) || defined(__INTEL_COMPILER) || defined(__CUDACC__) || defined(__PGI)) \
&& (defined(__i386__) || defined(__x86_64__) || defined(__ia64__))
# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
/* note: __float128 is a typedef, which is not supported with the _Complex
keyword in gcc, so instead we use this ugly __attribute__ version.
However, we can't simply pass the __attribute__ version to
FFTW_DEFINE_API because the __attribute__ confuses gcc in pointer
types. Hence redefining FFTW_DEFINE_COMPLEX. Ugh. */
# undef FFTW_DEFINE_COMPLEX
# define FFTW_DEFINE_COMPLEX(R, C) typedef _Complex float __attribute__((mode(TC))) C
# endif
FFTW_DEFINE_API(FFTW_MANGLE_QUAD, __float128, fftwq_complex)
#endif
#define FFTW_FORWARD (-1)
#define FFTW_BACKWARD (+1)
#define FFTW_NO_TIMELIMIT (-1.0)
/* documented flags */
#define FFTW_MEASURE (0U)
#define FFTW_DESTROY_INPUT (1U << 0)
#define FFTW_UNALIGNED (1U << 1)
#define FFTW_CONSERVE_MEMORY (1U << 2)
#define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */
#define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */
#define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */
#define FFTW_ESTIMATE (1U << 6)
#define FFTW_WISDOM_ONLY (1U << 21)
/* undocumented beyond-guru flags */
#define FFTW_ESTIMATE_PATIENT (1U << 7)
#define FFTW_BELIEVE_PCOST (1U << 8)
#define FFTW_NO_DFT_R2HC (1U << 9)
#define FFTW_NO_NONTHREADED (1U << 10)
#define FFTW_NO_BUFFERING (1U << 11)
#define FFTW_NO_INDIRECT_OP (1U << 12)
#define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */
#define FFTW_NO_RANK_SPLITS (1U << 14)
#define FFTW_NO_VRANK_SPLITS (1U << 15)
#define FFTW_NO_VRECURSE (1U << 16)
#define FFTW_NO_SIMD (1U << 17)
#define FFTW_NO_SLOW (1U << 18)
#define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19)
#define FFTW_ALLOW_PRUNING (1U << 20)
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FFTW3_H */
此差异已折叠。
此差异已折叠。
#include "specwidget.h"
#ifdef Q_OS_LINUX
#include <unistd.h>
#endif
#include <QApplication>
#include <QLibraryInfo>
#include <QTranslator>
int main(int argc, char *argv[])
{
#ifdef Q_OS_LINUX
nice(0);
#endif
QApplication a(argc, argv);
//Install translators
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
a.installTranslator(&qtTranslator);
QTranslator appTranslator;
QString strTransLocalFile =
":/" +
QCoreApplication::applicationName()+"_"+
QLocale::system().name()+".qm";
appTranslator.load(strTransLocalFile );
a.installTranslator(&appTranslator);
specWidget w;
w.show();
return a.exec();
}
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
*
* Copyright 2013 Christian Lindner DL2VCL, Stefano Leucci.
*
* Gqrx 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 3, or (at your option)
* any later version.
*
* Gqrx 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 Gqrx; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include <Qt>
#include <QFile>
#include <QStringList>
#include <QTextStream>
#include <QString>
#include <QSet>
#include <algorithm>
#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;
#if QT_VERSION < 0x051500
#define ENDL endl
#else
#define ENDL Qt::endl
#endif
Bookmarks::Bookmarks()
{
TagInfo tag(TagInfo::strUntagged);
m_TagList.append(tag);
}
void Bookmarks::create()
{
m_pThis = new Bookmarks;
}
Bookmarks& Bookmarks::Get()
{
return *m_pThis;
}
void Bookmarks::setConfigDir(const QString& cfg_dir)
{
m_bookmarksFile = cfg_dir + "/bookmarks.csv";
printf("BookmarksFile is %s\n", m_bookmarksFile.toStdString().c_str());
}
void Bookmarks::add(BookmarkInfo &info)
{
m_BookmarkList.append(info);
std::stable_sort(m_BookmarkList.begin(),m_BookmarkList.end());
save();
emit( BookmarksChanged() );
}
void Bookmarks::remove(int index)
{
m_BookmarkList.removeAt(index);
save();
emit BookmarksChanged();
}
bool Bookmarks::load()
{
QFile file(m_bookmarksFile);
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
m_BookmarkList.clear();
m_TagList.clear();
// always create the "Untagged" entry.
findOrAddTag(TagInfo::strUntagged);
// Read Tags, until first empty line.
while (!file.atEnd())
{
QString line = QString::fromUtf8(file.readLine().trimmed());
if(line.isEmpty())
break;
if(line.startsWith("#"))
continue;
QStringList strings = line.split(";");
if(strings.count() == 2)
{
TagInfo &info = findOrAddTag(strings[0]);
info.color = QColor(strings[1].trimmed());
}
else
{
printf("\nBookmarks: Ignoring Line:\n %s\n", line.toLatin1().data());
}
}
std::sort(m_TagList.begin(),m_TagList.end());
// Read Bookmarks, after first empty line.
while (!file.atEnd())
{
QString line = QString::fromUtf8(file.readLine().trimmed());
if(line.isEmpty() || line.startsWith("#"))
continue;
QStringList strings = line.split(";");
if(strings.count() == 5)
{
BookmarkInfo info;
info.frequency = strings[0].toLongLong();
info.name = strings[1].trimmed();
info.modulation = strings[2].trimmed();
info.bandwidth = strings[3].toInt();
// Multiple Tags may be separated by comma.
QString strTags = strings[4];
QStringList TagList = strTags.split(",");
for(int iTag=0; iTag<TagList.size(); ++iTag)
{
info.tags.append(&findOrAddTag(TagList[iTag].trimmed()));
}
m_BookmarkList.append(info);
}
else
{
printf("\nBookmarks: Ignoring Line:\n %s\n", line.toLatin1().data());
}
}
file.close();
std::stable_sort(m_BookmarkList.begin(),m_BookmarkList.end());
emit BookmarksChanged();
return true;
}
return false;
}
//FIXME: Commas in names
bool Bookmarks::save()
{
QFile file(m_bookmarksFile);
if(file.open(QFile::WriteOnly | QFile::Truncate | QIODevice::Text))
{
QTextStream stream(&file);
stream << QString("# Tag name").leftJustified(20) + "; " +
QString(" color") << ENDL;
QSet<TagInfo*> usedTags;
for (int iBookmark = 0; iBookmark < m_BookmarkList.size(); iBookmark++)
{
BookmarkInfo& info = m_BookmarkList[iBookmark];
for(int iTag = 0; iTag < info.tags.size(); ++iTag)
{
TagInfo& tag = *info.tags[iTag];
usedTags.insert(&tag);
}
}
for (QSet<TagInfo*>::iterator i = usedTags.begin(); i != usedTags.end(); i++)
{
TagInfo& info = **i;
stream << info.name.leftJustified(20) + "; " + info.color.name() << ENDL;
}
stream << ENDL;
stream << QString("# Frequency").leftJustified(12) + "; " +
QString("Name").leftJustified(25)+ "; " +
QString("Modulation").leftJustified(20) + "; " +
QString("Bandwidth").rightJustified(10) + "; " +
QString("Tags") << ENDL;
for (int i = 0; i < m_BookmarkList.size(); i++)
{
BookmarkInfo& info = m_BookmarkList[i];
QString line = QString::number(info.frequency).rightJustified(12) +
"; " + info.name.leftJustified(25) + "; " +
info.modulation.leftJustified(20)+ "; " +
QString::number(info.bandwidth).rightJustified(10) + "; ";
for(int iTag = 0; iTag<info.tags.size(); ++iTag)
{
TagInfo& tag = *info.tags[iTag];
if(iTag!=0)
{
line.append(",");
}
line.append(tag.name);
}
stream << line << ENDL;
}
file.close();
return true;
}
return false;
}
QList<BookmarkInfo> Bookmarks::getBookmarksInRange(qint64 low, qint64 high)
{
BookmarkInfo info;
info.frequency=low;
QList<BookmarkInfo>::const_iterator lb = std::lower_bound(m_BookmarkList.begin(), m_BookmarkList.end(),info);
info.frequency=high;
QList<BookmarkInfo>::const_iterator ub = std::upper_bound(m_BookmarkList.begin(), m_BookmarkList.end(),info);
QList<BookmarkInfo> found;
while (lb != ub)
{
const BookmarkInfo& info = *lb;
//if(info.IsActive())
{
found.append(info);
}
lb++;
}
return found;
}
TagInfo &Bookmarks::findOrAddTag(QString tagName)
{
tagName = tagName.trimmed();
if (tagName.isEmpty())
tagName=TagInfo::strUntagged;
int idx = getTagIndex(tagName);
if (idx != -1)
return m_TagList[idx];
TagInfo info;
info.name=tagName;
m_TagList.append(info);
emit TagListChanged();
return m_TagList.last();
}
bool Bookmarks::removeTag(QString tagName)
{
tagName = tagName.trimmed();
// Do not delete "Untagged" tag.
if(tagName.compare(TagInfo::strUntagged, tagName)==0)
return false;
int idx = getTagIndex(tagName);
if (idx == -1)
return false;
// Delete Tag from all Bookmarks that use it.
TagInfo* pTagToDelete = &m_TagList[idx];
for(int i=0; i<m_BookmarkList.size(); ++i)
{
BookmarkInfo& bmi = m_BookmarkList[i];
for(int t=0; t<bmi.tags.size(); ++t)
{
TagInfo* pTag = bmi.tags[t];
if(pTag == pTagToDelete)
{
if(bmi.tags.size()>1) bmi.tags.removeAt(t);
else bmi.tags[0] = &findOrAddTag(TagInfo::strUntagged);
}
}
}
// Delete Tag.
m_TagList.removeAt(idx);
emit BookmarksChanged();
emit TagListChanged();
return true;
}
bool Bookmarks::setTagChecked(QString tagName, bool bChecked)
{
int idx = getTagIndex(tagName);
if (idx == -1) return false;
m_TagList[idx].active = bChecked;
emit BookmarksChanged();
emit TagListChanged();
return true;
}
int Bookmarks::getTagIndex(QString tagName)
{
tagName = tagName.trimmed();
for (int i = 0; i < m_TagList.size(); i++)
{
if (m_TagList[i].name == tagName)
return i;
}
return -1;
}
const QColor BookmarkInfo::GetColor() const
{
for(int iTag=0; iTag<tags.size(); ++iTag)
{
TagInfo& tag = *tags[iTag];
if(tag.active)
{
return tag.color;
}
}
return TagInfo::DefaultColor;
}
bool BookmarkInfo::IsActive() const
{
bool bActive = false;
for(int iTag=0; iTag<tags.size(); ++iTag)
{
TagInfo& tag = *tags[iTag];
if(tag.active)
{
bActive = true;
break;
}
}
return bActive;
}
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
*
* Copyright 2013 Christian Lindner DL2VCL, Stefano Leucci.
*
* Gqrx 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 3, or (at your option)
* any later version.
*
* Gqrx 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 Gqrx; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef BOOKMARKS_H
#define BOOKMARKS_H
#include <QtGlobal>
#include <QObject>
#include <QString>
#include <QMap>
#include <QList>
#include <QStringList>
#include <QColor>
struct TagInfo
{
QString name;
QColor color;
bool active;
static const QColor DefaultColor;
static const QString strUntagged;
TagInfo()
{
active=true;
this->color=DefaultColor;
}
TagInfo(QString name)
{
active=true;
this->color=DefaultColor;
this->name = name;
}
bool operator<(const TagInfo &other) const
{
return name < other.name;
}
};
struct BookmarkInfo
{
qint64 frequency;
QString name;
QString modulation;
qint64 bandwidth;
QList<TagInfo*> tags;
BookmarkInfo()
{
this->frequency = 0;
this->bandwidth = 0;
}
/* BookmarkInfo( qint64 frequency, QString name, qint64 bandwidth, QString modulation )
{
this->frequency = frequency;
this->name = name;
this->modulation = modulation;
this->bandwidth = bandwidth;
}
*/
bool operator<(const BookmarkInfo &other) const
{
return frequency < other.frequency;
}
/*
void setTags(QString tagString);
QString getTagString();
bool hasTags(QString _tags);
bool hasTags(QStringList _tags);
*/
const QColor GetColor() const;
bool IsActive() const;
};
class Bookmarks : public QObject
{
Q_OBJECT
public:
// This is a Singleton Class now because you can not send qt-signals from static functions.
static void create();
static Bookmarks& Get();
void add(BookmarkInfo& info);
void remove(int index);
bool load();
bool save();
int size() { return m_BookmarkList.size(); }
BookmarkInfo& getBookmark(int i) { return m_BookmarkList[i]; }
QList<BookmarkInfo> getBookmarksInRange(qint64 low, qint64 high);
//int lowerBound(qint64 low);
//int upperBound(qint64 high);
QList<TagInfo> getTagList() { return QList<TagInfo>(m_TagList); }
TagInfo& findOrAddTag(QString tagName);
int getTagIndex(QString tagName);
bool removeTag(QString tagName);
bool setTagChecked(QString tagName, bool bChecked);
void setConfigDir(const QString&);
private:
Bookmarks(); // Singleton Constructor is private.
QList<BookmarkInfo> m_BookmarkList;
QList<TagInfo> m_TagList;
QString m_bookmarksFile;
static Bookmarks* m_pThis;
signals:
void BookmarksChanged(void);
void TagListChanged(void);
};
#endif // BOOKMARKS_H
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
*
* Copyright 2013 Christian Lindner DL2VCL, Stefano Leucci.
*
* Gqrx 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 3, or (at your option)
* any later version.
*
* Gqrx 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 Gqrx; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include <QFile>
#include <QStringList>
#include "bookmarks.h"
#include "bookmarkstablemodel.h"
BookmarksTableModel::BookmarksTableModel(QObject *parent) :
QAbstractTableModel(parent)
{
}
int BookmarksTableModel::rowCount ( const QModelIndex & /*parent*/ ) const
{
return m_Bookmarks.size();
}
int BookmarksTableModel::columnCount ( const QModelIndex & /*parent*/ ) const
{
return 5;
}
QVariant BookmarksTableModel::headerData ( int section, Qt::Orientation orientation, int role ) const
{
if(orientation == Qt::Horizontal && role == Qt::DisplayRole)
{
switch(section)
{
case COL_FREQUENCY:
return QString("Frequency");
break;
case COL_NAME:
return QString("Name");
break;
case COL_MODULATION:
return QString("Modulation");
break;
case COL_BANDWIDTH:
return QString("Bandwidth");
break;
case COL_TAGS:
return QString("Tag");
break;
}
}
if(orientation == Qt::Vertical && role == Qt::DisplayRole)
{
return section;
}
return QVariant();
}
QVariant BookmarksTableModel::data ( const QModelIndex & index, int role ) const
{
BookmarkInfo& info = *m_Bookmarks[index.row()];
if(role==Qt::BackgroundRole)
{
QColor bg(info.GetColor());
bg.setAlpha(0x60);
return bg;
}
else if(role == Qt::DisplayRole || role==Qt::EditRole)
{
switch(index.column())
{
case COL_FREQUENCY:
return info.frequency;
case COL_NAME:
return (role==Qt::EditRole)?QString(info.name):info.name;
case COL_MODULATION:
return info.modulation;
case COL_BANDWIDTH:
return (info.bandwidth==0)?QVariant(""):QVariant(info.bandwidth);
case COL_TAGS:
QString strTags;
for(int iTag=0; iTag<info.tags.size(); ++iTag)
{
if(iTag!=0)
{
strTags.append(",");
}
TagInfo& tag = *info.tags[iTag];
strTags.append(tag.name);
}
return strTags;
}
}
return QVariant();
}
bool BookmarksTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if(role==Qt::EditRole)
{
BookmarkInfo &info = *m_Bookmarks[index.row()];
switch(index.column())
{
case COL_FREQUENCY:
{
info.frequency = value.toLongLong();
emit dataChanged(index, index);
}
break;
case COL_NAME:
{
info.name = value.toString();
emit dataChanged(index, index);
return true;
}
break;
case COL_MODULATION:
break;
case COL_BANDWIDTH:
{
info.bandwidth = value.toInt();
emit dataChanged(index, index);
}
break;
case COL_TAGS:
{
info.tags.clear();
QString strValue = value.toString();
QStringList strList = strValue.split(",");
for(int i=0; i<strList.size(); ++i)
{
QString strTag = strList[i].trimmed();
info.tags.append( &Bookmarks::Get().findOrAddTag(strTag) );
}
emit dataChanged(index, index);
return true;
}
break;
}
return true; // return true means success
}
return false;
}
Qt::ItemFlags BookmarksTableModel::flags ( const QModelIndex& index ) const
{
Qt::ItemFlags flags = Qt::NoItemFlags;
switch(index.column())
{
case COL_FREQUENCY:
case COL_NAME:
case COL_BANDWIDTH:
case COL_MODULATION:
flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
break;
case COL_TAGS:
flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
break;
}
return flags;
}
void BookmarksTableModel::update()
{
int iRow = 0;
m_Bookmarks.clear();
for(int iBookmark=0; iBookmark<Bookmarks::Get().size(); iBookmark++)
{
BookmarkInfo& info = Bookmarks::Get().getBookmark(iBookmark);
bool bActive = false;
for(int iTag=0; iTag<info.tags.size(); ++iTag)
{
TagInfo& tag = *info.tags[iTag];
if(tag.active)
{
bActive = true;
break;
}
}
if(bActive)
{
m_mapRowToBookmarksIndex[iRow]=iBookmark;
m_Bookmarks.append(&info);
++iRow;
}
}
emit layoutChanged();
}
BookmarkInfo *BookmarksTableModel::getBookmarkAtRow(int row)
{
return m_Bookmarks[row];
}
int BookmarksTableModel::GetBookmarksIndexForRow(int iRow)
{
return m_mapRowToBookmarksIndex[iRow];
}
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
*
* Copyright 2013 Christian Lindner DL2VCL, Stefano Leucci.
*
* Gqrx 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 3, or (at your option)
* any later version.
*
* Gqrx 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 Gqrx; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef BOOKMARKSTABLEMODEL_H
#define BOOKMARKSTABLEMODEL_H
#include <QAbstractTableModel>
#include <QList>
#include "bookmarks.h"
class BookmarksTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum EColumns
{
COL_FREQUENCY,
COL_NAME,
COL_MODULATION,
COL_BANDWIDTH,
COL_TAGS
};
explicit BookmarksTableModel(QObject *parent = 0);
int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
Qt::ItemFlags flags ( const QModelIndex & index ) const;
BookmarkInfo* getBookmarkAtRow(int row);
int GetBookmarksIndexForRow(int iRow);
private:
QList<BookmarkInfo*> m_Bookmarks;
QMap<int,int> m_mapRowToBookmarksIndex;
signals:
public slots:
void update();
};
#endif
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
*
* Copyright 2014 Stefano Leucci, Christian Lindner DL2VCL.
*
* Gqrx 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 3, or (at your option)
* any later version.
*
* Gqrx 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 Gqrx; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include "bookmarkstaglist.h"
#include "bookmarks.h"
#include <QColorDialog>
#include <stdio.h>
#include <QMenu>
#include <QHeaderView>
BookmarksTagList::BookmarksTagList(QWidget *parent, bool bShowUntagged )
: QTableWidget(parent)
, m_bUpdating(false)
, m_bShowUntagged(bShowUntagged)
{
connect(this, SIGNAL(cellClicked(int,int)),
this, SLOT(on_cellClicked(int,int)));
// right click menu
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(ShowContextMenu(const QPoint&)));
horizontalHeader()->setVisible(false);
verticalHeader()->setVisible(false);
setColumnCount(2);
setColumnWidth(0, 20);
horizontalHeader()->setStretchLastSection(true);
setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows);
setSortingEnabled(true);
}
void BookmarksTagList::on_cellClicked(int row, int column)
{
if(column==0)
{
changeColor(row, column);
}
if(column==1)
{
toggleCheckedState(row, column);
}
}
void BookmarksTagList::changeColor(int row, int /*column*/)
{
TagInfo &info = Bookmarks::Get().findOrAddTag(item(row, 1)->text());
QColor color = QColorDialog::getColor(info.color, this);
if(!color.isValid())
return;
info.color=color;
updateTags();
Bookmarks::Get().save();
}
void BookmarksTagList::toggleCheckedState(int row, int column)
{
QTableWidgetItem* p = item(row,column);
if(p->checkState()==Qt::Unchecked)
{
p->setCheckState(Qt::Checked);
}
else
{
p->setCheckState(Qt::Unchecked);
}
}
void BookmarksTagList::updateTags()
{
m_bUpdating = true;
// Remember which items were unchecked.
QStringList unchecked;
for(int i=0; i<rowCount(); i++)
{
if(item(i,1)->checkState()==Qt::Unchecked)
unchecked.append(item(i,1)->text());
}
// Get current List of Tags.
QList<TagInfo> newTags = Bookmarks::Get().getTagList();
if(!m_bShowUntagged)
{
for(int i=0; i<newTags.size(); ++i)
{
TagInfo& taginfo = newTags[i];
if(taginfo.name.compare(TagInfo::strUntagged)==0)
{
newTags.removeAt(i);
break;
}
}
}
// Rebuild List in GUI.
clear();
setSortingEnabled(false);
setRowCount(0);
for(int i=0; i<newTags.count(); i++)
{
AddTag(newTags[i].name,
( unchecked.contains(newTags[i].name) ? Qt::Unchecked : Qt::Checked ),
newTags[i].color);
}
setSortingEnabled(true);
m_bUpdating = false;
}
void BookmarksTagList::setSelectedTagsAsString(const QString& strTags)
{
QStringList list = strTags.split(",");
int iRows = rowCount();
for(int i=0; i<iRows; ++i)
{
QTableWidgetItem* pItem = item(i,1);
QString name = pItem->text();
bool bChecked = list.contains(name);
pItem->setCheckState(bChecked ? Qt::Checked : Qt::Unchecked);
}
setSortingEnabled(true);
}
void BookmarksTagList::setSelectedTags(QList<TagInfo*> tags)
{
int iRows = rowCount();
for(int i=0; i<iRows; ++i)
{
QTableWidgetItem* pItem = item(i,1);
QString name = pItem->text();
bool bChecked = false;
for(QList<TagInfo*>::const_iterator it=tags.begin(), itend=tags.end(); it!=itend; ++it)
{
TagInfo* pTag = *it;
if(pTag->name == name) bChecked = true;
}
pItem->setCheckState(bChecked ? Qt::Checked : Qt::Unchecked);
}
setSortingEnabled(true);
}
QString BookmarksTagList::getSelectedTagsAsString()
{
QString strResult;
int iRows = rowCount();
bool bFirst = true;
for(int i=0; i<iRows; ++i)
{
QTableWidgetItem* pItem = item(i,1);
if(pItem->checkState() == Qt::Checked)
{
if(!bFirst) strResult += ", ";
strResult += pItem->text();
bFirst = false;
}
}
return strResult;
}
void BookmarksTagList::ShowContextMenu(const QPoint& pos)
{
QMenu* menu=new QMenu(this);
// Rename currently does not work.
// The problem is that after the tag name is changed in GUI
// you can not find the right TagInfo because you dont know
// the old tag name.
#if 0
// MenuItem "Rename"
{
QAction* actionRename = new QAction("Rename", this);
menu->addAction(actionRename);
connect(actionRename, SIGNAL(triggered()), this, SLOT(RenameSelectedTag()));
}
#endif
// MenuItem "Create new Tag"
{
QAction* actionNewTag = new QAction("Create new Tag", this);
menu->addAction(actionNewTag);
connect(actionNewTag, SIGNAL(triggered()), this, SLOT(AddNewTag()));
}
// Menu "Delete Tag"
{
QAction* actionDeleteTag = new QAction("Delete Tag", this);
menu->addAction(actionDeleteTag);
connect(actionDeleteTag, SIGNAL(triggered()), this, SLOT(DeleteSelectedTag()));
}
// Menu "Select All"
{
QAction* action = new QAction("Select All", this);
menu->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(SelectAll()));
}
// Menu "Deselect All"
{
QAction* action = new QAction("Deselect All", this);
menu->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(DeselectAll()));
}
menu->popup(viewport()->mapToGlobal(pos));
}
#if 0
bool BookmarksTagList::RenameSelectedTag()
{
QModelIndexList selected = selectionModel()->selectedRows();
if(selected.empty())
{
return true;
}
int iRow = selected.first().row();
QTableWidgetItem* pItem = item(iRow,1);bUpdating
editItem(pItem);
//Bookmarks::Get().save();
return true;
}
#endif
void BookmarksTagList::AddNewTag()
{
AddTag("*new*");
scrollToBottom();
editItem(item(rowCount()-1, 1));
}
void BookmarksTagList::AddTag(QString name, Qt::CheckState checkstate, QColor color)
{
int i = rowCount();
setRowCount(i+1);
// Column 1
QTableWidgetItem *item = new QTableWidgetItem(name);
item->setCheckState(checkstate);
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
setItem(i, 1, item);
// Column 0
item = new QTableWidgetItem();
item->setFlags(Qt::ItemIsEnabled);
item->setBackground(color);
setItem(i, 0, item);
}
void BookmarksTagList::DeleteSelectedTag()
{
QModelIndexList selected = selectionModel()->selectedRows();
if(selected.empty())
{
return;
}
int iRow = selected.first().row();
QTableWidgetItem* pItem = item(iRow,1);
QString strTagName = pItem->text();
DeleteTag(strTagName);
return;
}
void BookmarksTagList::DeleteTag(const QString& name)
{
Bookmarks::Get().removeTag(name);
updateTags();
}
void BookmarksTagList::SelectAll()
{
int iRows = rowCount();
for(int i=0; i<iRows; ++i)
{
QTableWidgetItem* pItem = item(i,1);
QString name = pItem->text();
pItem->setCheckState(Qt::Checked);
}
}
void BookmarksTagList::DeselectAll()
{
int iRows = rowCount();
for(int i=0; i<iRows; ++i)
{
QTableWidgetItem* pItem = item(i,1);
QString name = pItem->text();
pItem->setCheckState(Qt::Unchecked);
}
}
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
*
* Copyright 2014 Stefano Leucci, Christian Lindner DL2VCL.
*
* Gqrx 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 3, or (at your option)
* any later version.
*
* Gqrx 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 Gqrx; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef BOOKMARKSTAGLIST_H
#define BOOKMARKSTAGLIST_H
#include <QTableWidget>
#include "bookmarks.h"
/// A QWidget containing the List of Bookmark-Tags.
class BookmarksTagList : public QTableWidget
{
Q_OBJECT
public:
explicit BookmarksTagList(QWidget *parent = 0, bool bShowUntagged = true);
QString getSelectedTagsAsString();
void setSelectedTagsAsString(const QString& strTags);
void setSelectedTags(QList<TagInfo*> tags);
bool m_bUpdating;
private:
bool m_bShowUntagged;
signals:
public slots:
void updateTags();
void on_cellClicked(int row, int column);
void changeColor(int row, int column);
void toggleCheckedState(int row, int column);
void ShowContextMenu(const QPoint& pos);
//bool RenameSelectedTag();
void AddNewTag();
void AddTag(QString name, Qt::CheckState checkstate = Qt::Checked, QColor color = TagInfo::DefaultColor);
void DeleteSelectedTag();
void DeleteTag(const QString& name);
void SelectAll();
void DeselectAll();
};
#endif // BOOKMARKSTAGLIST_H
此差异已折叠。
/*
* Frequency controller widget (originally from CuteSDR)
*/
#pragma once
#include <QFrame>
#include <QImage>
#include <QtGui>
enum FctlUnit {
FCTL_UNIT_NONE, // Freq displayed without unit: 14.236.000
FCTL_UNIT_HZ,
FCTL_UNIT_KHZ,
FCTL_UNIT_MHZ,
FCTL_UNIT_GHZ,
FCTL_UNIT_SEC,
FCTL_UNIT_MSEC,
FCTL_UNIT_USEC,
FCTL_UNIT_NSEC
};
#define FCTL_MAX_DIGITS 12
#define FCTL_MIN_DIGITS 4
class CFreqCtrl : public QFrame
{
Q_OBJECT
public:
explicit CFreqCtrl(QWidget *parent = 0);
~CFreqCtrl();
QSize minimumSizeHint() const;
QSize sizeHint() const;
// Use NumDigits=0 for auto
void setup(int NumDigits, qint64 Minf, qint64 Maxf, int MinStep,
FctlUnit unit);
void setUnit(FctlUnit unit);
void setDigitColor(QColor col);
void setBgColor(QColor col);
void setUnitsColor(QColor col);
void setHighlightColor(QColor col);
qint64 getFrequency() const
{
return m_freq;
}
void setResetLowerDigits(bool reset)
{
m_ResetLowerDigits = reset;
}
signals:
void newFrequency(qint64 freq); // emitted when frequency has changed
public slots:
void setFrequency(qint64 freq);
protected:
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
void mouseMoveEvent(QMouseEvent *);
void mousePressEvent(QMouseEvent *);
void wheelEvent(QWheelEvent *);
void leaveEvent(QEvent *);
void keyPressEvent(QKeyEvent *);
private:
void updateCtrl(bool all);
void drawBkGround(QPainter &Painter);
void drawDigits(QPainter &Painter);
void incDigit();
void decDigit();
void incFreq();
void decFreq();
void clearFreq();
void cursorHome();
void cursorEnd();
void moveCursorLeft();
void moveCursorRight();
bool inRect(QRect &rect, QPoint &point);
bool inRect(QRect &rect, QPointF &point);
bool m_UpdateAll;
bool m_ExternalKeyActive;
bool m_LRMouseFreqSel; /* Use left/right mouse buttons. If FALSE click area determines up/down. */
bool m_ResetLowerDigits; /* If TRUE digits below the active one will be reset to 0
* when the active digit is incremented or decremented. */
int m_FirstEditableDigit;
int m_LastLeadZeroPos;
int m_LeadZeroPos;
int m_NumDigits;
int m_NumDigitsForUnit; // number of digits allocated for unit (kHz, MHz, ...)
int m_DigStart;
int m_ActiveEditDigit;
int m_LastEditDigit;
int m_DecPos;
int m_NumSeps;
qint64 m_MinStep;
qint64 m_freq;
qint64 m_Oldfreq;
qint64 m_MinFreq;
qint64 m_MaxFreq;
QColor m_DigitColor;
QColor m_BkColor;
QColor m_InactiveColor;
QColor m_UnitsColor;
QColor m_HighlightColor;
QPixmap m_Pixmap;
QSize m_Size;
FctlUnit m_Unit;
QRect m_rectCtrl; // main control rectangle
QRect m_UnitsRect; // rectangle where Units text goes
QRect m_SepRect[FCTL_MAX_DIGITS]; // separation rectangles for commas, decimal point, etc.
QString m_UnitString;
QFont m_DigitFont;
QFont m_UnitsFont;
struct DigStuct {
qint64 weight; // decimal weight of this digit
qint64 incval; // value this digit increments or decrements
QRect dQRect; // Digit bounding rectangle
int val; // value of this digit(0-9)
bool modified; // set if this digit has been modified
bool editmode; // set if this digit is selected for editing
} m_DigitInfo[FCTL_MAX_DIGITS];
};
/* -*- c++ -*- */
/* + + + This Software is released under the "Simplified BSD License" + + +
*
* Copyright 2010 Moe Wheatley. All rights reserved.
* Copyright 2011-2013 Alexandru Csete OZ9AEC.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY Moe Wheatley ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL Moe Wheatley OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Moe Wheatley.
*/
#include <cmath>
#include <QDebug>
#include "meter.h"
// ratio to total control width or height
#define CTRL_MARGIN 0.07 // left/right margin
#define CTRL_MAJOR_START 0.3 // top of major tic line
#define CTRL_MINOR_START 0.3 // top of minor tic line
#define CTRL_XAXIS_HEGHT 0.4 // vertical position of horizontal axis
#define CTRL_NEEDLE_TOP 0.4 // vertical position of top of needle triangle
#define MIN_DB -100.0f
#define MAX_DB +0.0f
#define ALPHA_DECAY 0.25f
#define ALPHA_RISE 0.70f
CMeter::CMeter(QWidget *parent) : QFrame(parent)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setFocusPolicy(Qt::StrongFocus);
setAttribute(Qt::WA_PaintOnScreen,false);
setAutoFillBackground(false);
setAttribute(Qt::WA_OpaquePaintEvent, false);
setAttribute(Qt::WA_NoSystemBackground, true);
setMouseTracking(true);
m_Font = QFont("Arial");
m_Font.setWeight(QFont::Normal);
m_2DPixmap = QPixmap(0,0);
m_OverlayPixmap = QPixmap(0,0);
m_Size = QSize(0,0);
m_pixperdb = 0.0f;
m_Siglevel = 0;
m_dBFS = MIN_DB;
m_Sql = -150.0f;
m_SqlLevel = 0.0f;
}
CMeter::~CMeter()
{
}
QSize CMeter::minimumSizeHint() const
{
return QSize(20, 10);
}
QSize CMeter::sizeHint() const
{
return QSize(100, 30);
}
void CMeter::resizeEvent(QResizeEvent *)
{
if (!size().isValid())
return;
if (m_Size != size())
{
// if size changed, resize pixmaps to new screensize
m_Size = size();
m_OverlayPixmap = QPixmap(m_Size.width(), m_Size.height());
m_OverlayPixmap.fill(Qt::black);
m_2DPixmap = QPixmap(m_Size.width(), m_Size.height());
m_2DPixmap.fill(Qt::black);
qreal w = m_2DPixmap.width() - 2 * CTRL_MARGIN * m_2DPixmap.width();
m_pixperdb = w / fabs(MAX_DB - MIN_DB);
setSqlLevel(m_Sql);
}
DrawOverlay();
draw();
}
void CMeter::setLevel(double dbfs)
{
if (dbfs < MIN_DB)
dbfs = MIN_DB;
else if (dbfs > MAX_DB)
dbfs = MAX_DB;
double level = m_dBFS;
double alpha = dbfs < level ? ALPHA_DECAY : ALPHA_RISE;
m_dBFS -= alpha * (level - dbfs);
m_Siglevel = (int)((level - MIN_DB) * m_pixperdb);
draw();
}
void CMeter::setSqlLevel(double dbfs)
{
if (dbfs >= 0.f)
m_SqlLevel = 0.0f;
else
m_SqlLevel = (dbfs - MIN_DB) * m_pixperdb;
if (m_SqlLevel < 0.0f)
m_SqlLevel = 0.0f;
m_Sql = dbfs;
}
// Called by QT when screen needs to be redrawn
void CMeter::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.drawPixmap(0, 0, m_2DPixmap);
return;
}
// Called to update s-meter data for displaying on the screen
void CMeter::draw()
{
int w;
int h;
if (m_2DPixmap.isNull())
return;
// get/draw the 2D spectrum
w = m_2DPixmap.width();
h = m_2DPixmap.height();
// first copy into 2Dbitmap the overlay bitmap.
m_2DPixmap = m_OverlayPixmap.copy(0, 0, w, h);
QPainter painter(&m_2DPixmap);
// DrawCurrent position indicator
qreal hline = (qreal) h * CTRL_XAXIS_HEGHT;
qreal marg = (qreal) w * CTRL_MARGIN;
qreal ht = (qreal) h * CTRL_NEEDLE_TOP;
qreal x = marg + m_Siglevel;
QPoint pts[3];
pts[0].setX(x);
pts[0].setY(ht + 2);
pts[1].setX(x - 6);
pts[1].setY(hline + 8);
pts[2].setX(x + 6);
pts[2].setY(hline + 8);
painter.setBrush(QBrush(QColor(0, 190, 0, 255)));
painter.setOpacity(1.0);
// Qt 4.8+ has a 1-pixel error (or they fixed line drawing)
// see http://stackoverflow.com/questions/16990326
#if QT_VERSION >= 0x040800
painter.drawRect(marg - 1, ht + 1, x - marg, 6);
#else
painter.drawRect(marg, ht + 2, x - marg, 6);
#endif
if (m_SqlLevel > 0.0f)
{
x = marg + m_SqlLevel;
painter.setPen(QPen(Qt::yellow, 1, Qt::SolidLine));
painter.drawLine(QLineF(x, hline, x, hline + 8));
}
int y = (h) / 4;
m_Font.setPixelSize(y);
painter.setFont(m_Font);
painter.setPen(QColor(0xDA, 0xDA, 0xDA, 0xFF));
painter.setOpacity(1.0);
m_Str.setNum(m_dBFS);
painter.drawText(marg, h - 2, m_Str + " dBFS" );
update();
}
// Called to draw an overlay bitmap containing items that
// does not need to be recreated every fft data update.
void CMeter::DrawOverlay()
{
if (m_OverlayPixmap.isNull())
return;
int w = m_OverlayPixmap.width();
int h = m_OverlayPixmap.height();
int x,y;
QRect rect;
QPainter painter(&m_OverlayPixmap);
m_OverlayPixmap.fill(QColor(0x1F, 0x1D, 0x1D, 0xFF));
// Draw scale lines
qreal marg = (qreal) w * CTRL_MARGIN;
qreal hline = (qreal)h * CTRL_XAXIS_HEGHT;
qreal magstart = (qreal) h * CTRL_MAJOR_START;
qreal minstart = (qreal) h * CTRL_MINOR_START;
qreal hstop = (qreal) w - marg;
painter.setPen(QPen(Qt::white, 1, Qt::SolidLine));
painter.drawLine(QLineF(marg, hline, hstop, hline)); // top line
painter.drawLine(QLineF(marg, hline+8, hstop, hline+8)); // bottom line
qreal xpos = marg;
for (x = 0; x < 11; x++) {
if (x & 1)
//minor tics
painter.drawLine(QLineF(xpos, minstart, xpos, hline));
else
painter.drawLine(QLineF(xpos, magstart, xpos, hline));
xpos += (hstop-marg) / 10.0;
}
// draw scale text
y = h / 4;
m_Font.setPixelSize(y);
painter.setFont(m_Font);
int rwidth = (int)((hstop - marg) / 5.0);
m_Str = "-100";
rect.setRect(marg / 2 - 5, 0, rwidth, magstart);
for (x = MIN_DB; x <= MAX_DB; x += 20)
{
m_Str.setNum(x);
painter.drawText(rect, Qt::AlignHCenter|Qt::AlignVCenter, m_Str);
rect.translate(rwidth, 0);
}
}
/* -*- c++ -*- */
/* + + + This Software is released under the "Simplified BSD License" + + +
*
* Copyright 2010 Moe Wheatley. All rights reserved.
* Copyright 2011-2013 Alexandru Csete OZ9AEC.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY Moe Wheatley ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL Moe Wheatley OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Moe Wheatley.
*/
#pragma once
#include <QtGui>
#include <QFrame>
#include <QImage>
class CMeter : public QFrame
{
Q_OBJECT
public:
explicit CMeter(QWidget *parent = 0);
explicit CMeter(double min_level = -100.0, double max_level = 10.0,
QWidget *parent = 0);
~CMeter();
QSize minimumSizeHint() const;
QSize sizeHint() const;
void setMin(double min_level);
void setMax(double max_level);
void setRange(double min_level, double max_level);
void draw();
void UpdateOverlay(){DrawOverlay();}
public slots:
void setLevel(double dbfs);
void setSqlLevel(double dbfs);
protected:
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent* event);
private:
void DrawOverlay();
QFont m_Font;
QPixmap m_2DPixmap;
QPixmap m_OverlayPixmap;
QSize m_Size;
QString m_Str;
qreal m_pixperdb; // pixels / dB
int m_Siglevel;
int m_dBFS;
qreal m_Sql;
qreal m_SqlLevel;
};
此差异已折叠。
/* -*- c++ -*- */
#ifndef PLOTTER_H
#define PLOTTER_H
#include <QtGui>
#include <QFont>
#include <QFrame>
#include <QImage>
#include <vector>
#include <QMap>
#define HORZ_DIVS_MAX 12 //50
#define VERT_DIVS_MIN 5
#define MAX_SCREENSIZE 16384
#define PEAK_CLICK_MAX_H_DISTANCE 10 //Maximum horizontal distance of clicked point from peak
#define PEAK_CLICK_MAX_V_DISTANCE 20 //Maximum vertical distance of clicked point from peak
#define PEAK_H_TOLERANCE 2
class CPlotter : public QFrame
{
Q_OBJECT
public:
explicit CPlotter(QWidget *parent = 0);
~CPlotter();
QSize minimumSizeHint() const;
QSize sizeHint() const;
//Size limit approach. When resolution is too large, update rate will be too slow without this approach.
QSize pixSize();
double pixRatio() const{return m_dPixRatio;}
QSize maxPixmapSize() const {return m_maxSize;}
void setMaxPixmapSize(QSize s){ m_maxSize = s;}
void draw(); //call to draw new fft data onto screen plot
void setRunningState(bool running) { m_Running = running; }
void setClickResolution(int clickres) { m_ClickResolution = clickres; }
void setFilterClickResolution(int clickres) { m_FilterClickResolution = clickres; }
void setFilterBoxEnabled(bool enabled) { m_FilterBoxEnabled = enabled; }
void setCenterLineEnabled(bool enabled) { m_CenterLineEnabled = enabled; }
void setTooltipsEnabled(bool enabled) { m_TooltipsEnabled = enabled; }
void setBookmarksEnabled(bool enabled) { m_BookmarksEnabled = enabled; }
void setNewFftData(const double *fftData, int size);
void setNewFftData(const double *fftData, const double *wfData, int size);
void setCenterFreq(quint64 f);
qint64 getCenterFreq() const {return m_CenterFreq;}
void setFreqUnits(qint32 unit) { m_FreqUnits = unit; }
void setDemodCenterFreq(quint64 f) { m_DemodCenterFreq = f; }
/*! \brief Move the filter to freq_hz from center. */
void setFilterOffset(qint64 freq_hz)
{
m_DemodCenterFreq = m_CenterFreq + freq_hz;
drawOverlay();
}
qint64 getFilterOffset(void)
{
return m_DemodCenterFreq - m_CenterFreq;
}
int getFilterBw()
{
return m_DemodHiCutFreq - m_DemodLowCutFreq;
}
void setHiLowCutFrequencies(int LowCut, int HiCut)
{
m_DemodLowCutFreq = LowCut;
m_DemodHiCutFreq = HiCut;
drawOverlay();
}
void getHiLowCutFrequencies(int *LowCut, int *HiCut)
{
*LowCut = m_DemodLowCutFreq;
*HiCut = m_DemodHiCutFreq;
}
void setDemodRanges(int FLowCmin, int FLowCmax, int FHiCmin, int FHiCmax, bool symetric);
/* Shown bandwidth around SetCenterFreq() */
void setSpanFreq(quint32 s)
{
if (s > 0 && s < INT_MAX) {
m_Span = (qint32)s;
setFftCenterFreq(m_FftCenter);
}
drawOverlay();
}
qint64 getSpanFreq() const {return m_Span;}
void setMaxBandiwdth(int m){m_FLowCmin = -m/2; m_FHiCmax = m/2; }
void setHdivDelta(int delta) { m_HdivDelta = delta; }
void setVdivDelta(int delta) { m_VdivDelta = delta; }
void setFreqDigits(int digits) { m_FreqDigits = digits>=0 ? digits : 0; }
/* Determines full bandwidth. */
void setSampleRate(double rate)
{
if (rate > 0.0)
{
m_SampleFreq = rate;
drawOverlay();
}
}
double getSampleRate(void)
{
return m_SampleFreq;
}
void setFftCenterFreq(qint64 f) {
qint64 limit = ((qint64)m_SampleFreq + m_Span) / 2 - 1;
m_FftCenter = qBound(-limit, f, limit);
}
int getNearestPeak(QPoint pt);
void setWaterfallSpan(quint64 span_ms);
quint64 getWfTimeRes(void);
void setFftRate(int rate_hz);
void clearWaterfall(void);
bool saveWaterfall(const QString & filename) const;
signals:
void newCenterFreq(qint64 f);
void newDemodFreq(qint64 freq, qint64 delta); /* delta is the offset from the center */
void newLowCutFreq(int f);
void newHighCutFreq(int f);
void newFilterFreq(int low, int high); /* substitute for NewLow / NewHigh */
void pandapterRangeChanged(double min, double max);
void newZoomLevel(double level);
public slots:
// zoom functions
void resetHorizontalZoom(void);
void moveToCenterFreq(void);
void moveToDemodFreq(void);
void zoomOnXAxis(double level);
// other FFT slots
void setFftPlotColor(const QColor color);
void setFftFill(bool enabled);
void setPeakHold(bool enabled);
void setFftRange(double min, double max);
void setPandapterRange(double min, double max);
void setWaterfallRange(double min, double max);
void setPeakDetection(bool enabled, double c);
void updateOverlay();
void setPercent2DScreen(int percent)
{
m_Percent2DScreen = percent;
m_Size = QSize(0,0);
resizeEvent(NULL);
}
protected:
//re-implemented widget event handlers
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent* event);
void mouseMoveEvent(QMouseEvent * event);
void mousePressEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
void wheelEvent( QWheelEvent * event );
private:
enum eCapturetype {
NOCAP,
LEFT,
CENTER,
RIGHT,
YAXIS,
XAXIS,
BOOKMARK
};
void drawOverlay();
void makeFrequencyStrs();
int xFromFreq(qint64 freq);
qint64 freqFromX(int x);
void zoomStepX(double factor, int x);
qint64 roundFreq(qint64 freq, int resolution);
quint64 msecFromY(int y);
void clampDemodParameters();
bool isPointCloseTo(int x, int xr, int delta)
{
return ((x > (xr - delta)) && (x < (xr + delta)));
}
void getScreenIntegerFFTData(qint32 plotHeight, qint32 plotWidth,
double maxdB, double mindB,
qint64 startFreq, qint64 stopFreq,
const double *inBuf, qint32 *outBuf,
qint32 *maxbin, qint32 *minbin);
void calcDivSize (qint64 low, qint64 high, int divswanted, qint64 &adjlow, qint64 &step, int& divs);
bool m_PeakHoldActive;
bool m_PeakHoldValid;
qint32 m_fftbuf[MAX_SCREENSIZE];
quint8 m_wfbuf[MAX_SCREENSIZE]; // used for accumulating waterfall data at high time spans
qint32 m_fftPeakHoldBuf[MAX_SCREENSIZE];
const double *m_fftData; /*! pointer to incoming FFT data */
const double *m_wfData;
int m_fftDataSize;
int m_XAxisYCenter;
int m_YAxisWidth;
eCapturetype m_CursorCaptured;
QPixmap m_2DPixmap;
QPixmap m_OverlayPixmap;
QPixmap m_WaterfallPixmap;
QColor m_ColorTbl[256];
QSize m_Size;
QString m_Str;
QString m_HDivText[HORZ_DIVS_MAX+1];
bool m_Running;
bool m_DrawOverlay;
qint64 m_CenterFreq; // The HW frequency
qint64 m_FftCenter; // Center freq in the -span ... +span range
qint64 m_DemodCenterFreq;
qint64 m_StartFreqAdj;
qint64 m_FreqPerDiv;
bool m_CenterLineEnabled; /*!< Distinguish center line. */
bool m_FilterBoxEnabled; /*!< Draw filter box. */
bool m_TooltipsEnabled; /*!< Tooltips enabled */
bool m_BookmarksEnabled; /*!< Show/hide bookmarks on spectrum */
int m_DemodHiCutFreq;
int m_DemodLowCutFreq;
int m_DemodFreqX; //screen coordinate x position
int m_DemodHiCutFreqX; //screen coordinate x position
int m_DemodLowCutFreqX; //screen coordinate x position
int m_CursorCaptureDelta;
int m_GrabPosition;
int m_Percent2DScreen;
int m_FLowCmin;
int m_FLowCmax;
int m_FHiCmin;
int m_FHiCmax;
bool m_symetric;
int m_HorDivs; /*!< Current number of horizontal divisions. Calculated from width. */
int m_VerDivs; /*!< Current number of vertical divisions. Calculated from height. */
double m_PandMindB;
double m_PandMaxdB;
double m_WfMindB;
double m_WfMaxdB;
qint64 m_Span;
double m_SampleFreq; /*!< Sample rate. */
qint32 m_FreqUnits;
int m_ClickResolution;
int m_FilterClickResolution;
int m_Xzero;
int m_Yzero; /*!< Used to measure mouse drag direction. */
int m_FreqDigits; /*!< Number of decimal digits in frequency strings. */
QFont m_Font; /*!< Font used for plotter (system font) */
int m_HdivDelta; /*!< Minimum distance in pixels between two horizontal grid lines (vertical division). */
int m_VdivDelta; /*!< Minimum distance in pixels between two vertical grid lines (horizontal division). */
quint32 m_LastSampleRate;
QColor m_FftColor, m_FftFillCol, m_PeakHoldColor;
bool m_FftFill;
double m_PeakDetection;
QMap<int,int> m_Peaks;
QList< QPair<QRect, qint64> > m_BookmarkTags;
// Waterfall averaging
quint64 tlast_wf_ms; // last time waterfall has been updated
quint64 msec_per_wfline; // milliseconds between waterfall updates
quint64 wf_span; // waterfall span in milliseconds (0 = auto)
int fft_rate; // expected FFT rate (needed when WF span is auto)
//Max pixmap size. Without this, for very large screen, update rate will be too slow.
QSize m_maxSize;
double m_dPixRatio = 1;
};
#endif // PLOTTER_H
<RCC>
<qresource prefix="/">
<file>uhdspectrum_zh_CN.qm</file>
</qresource>
</RCC>
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
项目迁移到独立的版本库,不再在此更新
https://codechina.csdn.net/coloreaglestdio/uhd_spectrum
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册