mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 13:48:42 -05:00
Add new CabrilloLogWindow widget to display/edit running contest log
This commit is contained in:
parent
5fdf0bdff4
commit
df4dbd546b
@ -266,6 +266,7 @@ set (wsjt_qt_CXXSRCS
|
||||
widgets/DecodeHighlightingListView.cpp
|
||||
models/FoxLog.cpp
|
||||
widgets/FoxLogWindow.cpp
|
||||
widgets/CabrilloLogWindow.cpp
|
||||
item_delegates/CallsignDelegate.cpp
|
||||
item_delegates/MaidenheadLocatorDelegate.cpp
|
||||
models/CabrilloLog.cpp
|
||||
@ -618,6 +619,7 @@ set (wsjt_CSRCS
|
||||
set (wsjt_qt_UISRCS
|
||||
wf_palette_design_dialog.ui
|
||||
widgets/FoxLogWindow.ui
|
||||
widgets/CabrilloLogWindow.ui
|
||||
)
|
||||
|
||||
set (wsprsim_CSRCS
|
||||
|
77
widgets/CabrilloLogWindow.cpp
Normal file
77
widgets/CabrilloLogWindow.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
#include "CabrilloLogWindow.hpp"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QDateTimeEdit>
|
||||
#include <QPainter>
|
||||
|
||||
#include "SettingsGroup.hpp"
|
||||
#include "Configuration.hpp"
|
||||
#include "models/Bands.hpp"
|
||||
#include "item_delegates/ForeignKeyDelegate.hpp"
|
||||
#include "item_delegates/DateTimeAsSecsSinceEpochDelegate.hpp"
|
||||
#include "item_delegates/CallsignDelegate.hpp"
|
||||
#include "item_delegates/MaidenheadLocatorDelegate.hpp"
|
||||
#include "widgets/MessageBox.hpp"
|
||||
#include "qt_helpers.hpp"
|
||||
|
||||
#include "ui_CabrilloLogWindow.h"
|
||||
|
||||
CabrilloLogWindow::CabrilloLogWindow (QSettings * settings, Configuration const * configuration
|
||||
, QAbstractItemModel * cabrillo_log_model, QWidget * parent)
|
||||
: QWidget {parent}
|
||||
, settings_ {settings}
|
||||
, configuration_ {configuration}
|
||||
, ui_ {new Ui::CabrilloLogWindow}
|
||||
{
|
||||
cabrillo_log_model_.setSourceModel (cabrillo_log_model);
|
||||
setWindowTitle (QApplication::applicationName () + " - Cabrillo Log");
|
||||
ui_->setupUi (this);
|
||||
read_settings ();
|
||||
change_font (configuration_->decoded_text_font ());
|
||||
ui_->log_table_view->setModel (&cabrillo_log_model_);
|
||||
ui_->log_table_view->setColumnHidden (0, true);
|
||||
ui_->log_table_view->setItemDelegateForColumn (2, new DateTimeAsSecsSinceEpochDelegate {this});
|
||||
ui_->log_table_view->setItemDelegateForColumn (3, new CallsignDelegate {this});
|
||||
ui_->log_table_view->setItemDelegateForColumn (6, new ForeignKeyDelegate {configuration_->bands (), &cabrillo_log_model_, 0, 6, this});
|
||||
ui_->log_table_view->setSelectionMode (QTableView::SingleSelection);
|
||||
auto horizontal_header = ui_->log_table_view->horizontalHeader ();
|
||||
horizontal_header->setStretchLastSection (true);
|
||||
horizontal_header->setSectionResizeMode (QHeaderView::ResizeToContents);
|
||||
horizontal_header->setSectionsMovable (true);
|
||||
horizontal_header->moveSection (6, 1); // band to first column
|
||||
ui_->log_table_view->scrollToBottom ();
|
||||
|
||||
// ensure view scrolls to latest new row
|
||||
connect (&cabrillo_log_model_, &QAbstractItemModel::rowsInserted, [this] (QModelIndex const& /*parent*/, int /*first*/, int /*last*/) {
|
||||
ui_->log_table_view->scrollToBottom ();
|
||||
});
|
||||
}
|
||||
|
||||
CabrilloLogWindow::~CabrilloLogWindow ()
|
||||
{
|
||||
write_settings ();
|
||||
}
|
||||
|
||||
void CabrilloLogWindow::read_settings ()
|
||||
{
|
||||
SettingsGroup g {settings_, "Cabrillo Log Window"};
|
||||
restoreGeometry (settings_->value ("window/geometery").toByteArray ());
|
||||
}
|
||||
|
||||
void CabrilloLogWindow::write_settings () const
|
||||
{
|
||||
SettingsGroup g {settings_, "Cabrillo Log Window"};
|
||||
settings_->setValue ("window/geometery", saveGeometry ());
|
||||
}
|
||||
|
||||
void CabrilloLogWindow::change_font (QFont const& font)
|
||||
{
|
||||
// ui_->log_table_view->setFont (font);
|
||||
// ui_->log_table_view->horizontalHeader ()->setFont (font);
|
||||
// ui_->log_table_view->verticalHeader ()->setFont (font);
|
||||
cabrillo_log_model_.set_font (font);
|
||||
}
|
39
widgets/CabrilloLogWindow.hpp
Normal file
39
widgets/CabrilloLogWindow.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef CABRILLO_LOG_WINDOW_HPP_
|
||||
#define CABRILLO_LOG_WINDOW_HPP_
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScopedPointer>
|
||||
#include <QIdentityProxyModel>
|
||||
#include "models/FontOverrideModel.hpp"
|
||||
|
||||
class QSettings;
|
||||
class Configuration;
|
||||
class QFont;
|
||||
class QDateTime;
|
||||
class QAbstractItemModel;
|
||||
namespace Ui
|
||||
{
|
||||
class CabrilloLogWindow;
|
||||
}
|
||||
|
||||
class CabrilloLogWindow final
|
||||
: public QWidget
|
||||
{
|
||||
public:
|
||||
explicit CabrilloLogWindow (QSettings *, Configuration const *, QAbstractItemModel * cabrillo_log_model
|
||||
, QWidget * parent = nullptr);
|
||||
~CabrilloLogWindow ();
|
||||
|
||||
void change_font (QFont const&);
|
||||
|
||||
private:
|
||||
void read_settings ();
|
||||
void write_settings () const;
|
||||
|
||||
QSettings * settings_;
|
||||
Configuration const * configuration_;
|
||||
FontOverrideModel cabrillo_log_model_;
|
||||
QScopedPointer<Ui::CabrilloLogWindow> ui_;
|
||||
};
|
||||
|
||||
#endif
|
16
widgets/CabrilloLogWindow.ui
Normal file
16
widgets/CabrilloLogWindow.ui
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CabrilloLogWindow</class>
|
||||
<widget class="QWidget" name="CabrilloLogWindow">
|
||||
<property name="windowTitle">
|
||||
<string>Contest Log</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableView" name="log_table_view"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -6,7 +6,8 @@ SOURCES += \
|
||||
widgets/mainwindow.cpp widgets/messageaveraging.cpp \
|
||||
widgets/echoplot.cpp widgets/echograph.cpp widgets/fastgraph.cpp \
|
||||
widgets/fastplot.cpp widgets/MessageBox.cpp \
|
||||
widgets/colorhighlighting.cpp widgets/ExportCabrillo.cpp
|
||||
widgets/colorhighlighting.cpp widgets/ExportCabrillo.cpp \
|
||||
widgets/CabrilloLogWindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
widgets/mainwindow.h widgets/plotter.h \
|
||||
@ -16,7 +17,8 @@ HEADERS += \
|
||||
widgets/meterwidget.h widgets/messageaveraging.h \
|
||||
widgets/echoplot.h widgets/echograph.h widgets/fastgraph.h \
|
||||
widgets/fastplot.h widgets/MessageBox.hpp widgets/colorhighlighting.h \
|
||||
widgets/ExportCabrillo.h
|
||||
widgets/ExportCabrillo.h \
|
||||
widgets/CabrilloLogWindow.cpp
|
||||
|
||||
FORMS += \
|
||||
widgets/mainwindow.ui widgets/about.ui \
|
||||
@ -24,4 +26,5 @@ FORMS += \
|
||||
widgets/logqso.ui widgets/messageaveraging.ui \
|
||||
widgets/echograph.ui widgets/fastgraph.ui \
|
||||
widgets/colorhighlighting.ui widgets/ExportCabrillo.ui \
|
||||
widgets/FoxLogWindow.ui
|
||||
widgets/FoxLogWindow.ui \
|
||||
widgets/CabrilloLogWindow.ui
|
||||
|
Loading…
Reference in New Issue
Block a user