Remove File > Open for Placefiles

This commit is contained in:
Dan Paulat 2023-09-17 00:59:33 -05:00
parent 4f16d92ba3
commit 47c1bce993
5 changed files with 0 additions and 90 deletions

View file

@ -401,28 +401,6 @@ void MainWindow::on_actionOpenNexrad_triggered()
dialog->open();
}
void MainWindow::on_actionOpenPlacefile_triggered()
{
static const std::string placefileFilter = "Placefiles (*)";
QFileDialog* dialog = new QFileDialog(this);
dialog->setFileMode(QFileDialog::ExistingFile);
dialog->setNameFilter(tr(placefileFilter.c_str()));
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog,
&QFileDialog::fileSelected,
this,
[this](const QString& file)
{
logger_->info("Selected: {}", file.toStdString());
p->placefileManager_->LoadFile(file.toStdString());
});
dialog->open();
}
void MainWindow::on_actionOpenTextEvent_triggered()
{
static const std::string textFilter = "Text Event Products (*.txt)";

View file

@ -33,7 +33,6 @@ signals:
private slots:
void on_actionOpenNexrad_triggered();
void on_actionOpenPlacefile_triggered();
void on_actionOpenTextEvent_triggered();
void on_actionSettings_triggered();
void on_actionExit_triggered();

View file

@ -51,7 +51,6 @@
<string>&amp;Open</string>
</property>
<addaction name="actionOpenNexrad"/>
<addaction name="actionOpenPlacefile"/>
<addaction name="actionOpenTextEvent"/>
</widget>
<addaction name="menu_Open"/>
@ -416,11 +415,6 @@
<string>&amp;Check for Updates</string>
</property>
</action>
<action name="actionOpenPlacefile">
<property name="text">
<string>&amp;Placefile...</string>
</property>
</action>
</widget>
<resources>
<include location="../../../../scwx-qt.qrc"/>

View file

@ -99,7 +99,6 @@ public:
void ScheduleRefresh();
void Update();
void UpdateAsync();
void UpdatePlacefile(const std::shared_ptr<gr::Placefile>& placefile);
friend void tag_invoke(boost::json::value_from_tag,
boost::json::value& jv,
@ -472,55 +471,6 @@ void PlacefileManager::AddUrl(const std::string& urlString,
}
}
void PlacefileManager::LoadFile(const std::string& filename)
{
const std::string placefileName =
QDir::toNativeSeparators(QString::fromStdString(filename)).toStdString();
logger_->debug("LoadFile: {}", placefileName);
boost::asio::post(
p->threadPool_,
[placefileName, this]()
{
// Load file
std::shared_ptr<gr::Placefile> placefile =
gr::Placefile::Load(placefileName);
if (placefile == nullptr)
{
return;
}
std::unique_lock lock(p->placefileRecordLock_);
// Determine if the placefile has been loaded previously
auto it = p->placefileRecordMap_.find(placefileName);
if (it != p->placefileRecordMap_.end())
{
// If the placefile has been loaded previously, update it
it->second->UpdatePlacefile(placefile);
lock.unlock();
Q_EMIT PlacefileUpdated(placefileName);
}
else
{
// If this is a new placefile, add it
auto& record = p->placefileRecords_.emplace_back(
std::make_shared<Impl::PlacefileRecord>(
p.get(), placefileName, placefile, placefile->title(), true));
p->placefileRecordMap_.insert_or_assign(placefileName, record);
lock.unlock();
Q_EMIT PlacefileEnabled(placefileName, record->enabled_);
Q_EMIT PlacefileUpdated(placefileName);
}
});
}
void PlacefileManager::RemoveUrl(const std::string& urlString)
{
std::unique_lock lock(p->placefileRecordLock_);
@ -715,16 +665,6 @@ void PlacefileManager::Impl::PlacefileRecord::UpdateAsync()
boost::asio::post(threadPool_, [this]() { Update(); });
}
void PlacefileManager::Impl::PlacefileRecord::UpdatePlacefile(
const std::shared_ptr<gr::Placefile>& placefile)
{
// Update placefile
placefile_ = placefile;
// Update refresh timer
ScheduleRefresh();
}
std::shared_ptr<PlacefileManager> PlacefileManager::Instance()
{
static std::weak_ptr<PlacefileManager> placefileManagerReference_ {};

View file

@ -42,7 +42,6 @@ public:
const std::string& title = {},
bool enabled = false,
bool thresholded = false);
void LoadFile(const std::string& filename);
void RemoveUrl(const std::string& urlString);
static std::shared_ptr<PlacefileManager> Instance();