Skip to content

Commit

Permalink
Merging in new code from master
Browse files Browse the repository at this point in the history
Includes updating parts due to this branches recent changes.
  • Loading branch information
SimonCSmith committed Mar 9, 2023
2 parents 863fe7b + 8841e7f commit d0e1e38
Show file tree
Hide file tree
Showing 24 changed files with 305 additions and 182 deletions.
4 changes: 2 additions & 2 deletions DeepSkyStacker.VS2019.sln → DeepSkyStacker.VS2022.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30406.217
# Visual Studio Version 17
VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{A8F4069D-F6D1-4A9A-A4E5-9A22B411D691}"
EndProject
Expand Down
22 changes: 6 additions & 16 deletions DeepSkyStacker/BitmapExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "File.h"
#include "MedianFilterEngine.h"
#include "omp.h"
#include "dssbase.h"

#ifndef _CONSOLE
#include "DeepSkyStacker.h"
Expand Down Expand Up @@ -972,32 +973,21 @@ bool GetPictureInfo(LPCTSTR szFileName, CBitmapInfo& BitmapInfo)
bool FetchPicture(const fs::path filePath, std::shared_ptr<CMemoryBitmap>& rpBitmap, ProgressBase* const pProgress)
{
ZFUNCTRACE_RUNTIME();
ZTRACE_RUNTIME("Processing file %s", filePath.generic_string().c_str());
bool bResult = false;

const auto fileName = filePath.generic_wstring(); // Otherwise szFileName could be a dangling pointer.
const wchar_t* szFileName = fileName.c_str();

if (fs::status(filePath).type() != fs::file_type::regular)
{
ZTRACE_RUNTIME("File %s not found", filePath.generic_string().c_str());
QString errorMessage{ QCoreApplication::translate(
"DSS::StackingDlg",
"%1 does not exist or is not a file").arg(QString::fromStdWString(fileName)) };
#if defined(_CONSOLE)
std::cerr << errorMessage.toUtf8().constData();
#else
DeepSkyStacker* dss = DeepSkyStacker::instance();
if (nullptr != dss)
{
bool result = QMetaObject::invokeMethod(dss, "displayMessageBox", Qt::QueuedConnection,
Q_ARG(const QString&, errorMessage),
Q_ARG(QMessageBox::Icon, QMessageBox::Warning));
}
else // This is here for DeepSkyStackerLive which is not yet Qt
{
AfxMessageBox(errorMessage.toStdWString().c_str(), MB_OK | MB_ICONWARNING);
}

#endif

DSSBase::instance()->reportError(errorMessage, DSSBase::Severity::Warning);

return false;
}

Expand Down
22 changes: 13 additions & 9 deletions DeepSkyStacker/DeepSkyStacker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ void DeepSkyStacker::updateStatus(const QString& text)
statusBarText->setText(text);
}

void DeepSkyStacker::displayMessageBox(const QString& message, QMessageBox::Icon icon)
void DeepSkyStacker::displayMessage(const QString& message, QMessageBox::Icon icon)
{
QMessageBox msgBox{ icon, "DeepSkyStacker", message, QMessageBox::Ok , this};
QMessageBox msgBox{ icon, "DeepSkyStacker", message, QMessageBox::Ok , this };
msgBox.exec();
}

Expand Down Expand Up @@ -442,6 +442,10 @@ DeepSkyStacker::DeepSkyStacker() :
setAcceptDrops(true);
}

DeepSkyStacker::~DeepSkyStacker()
{
}

void DeepSkyStacker::disableSubDialogs()
{
stackingDlg->setEnabled(false);
Expand Down Expand Up @@ -486,12 +490,6 @@ QString DeepSkyStacker::statusMessage()
return statusBarText->text();
}

void DeepSkyStacker::setInstance(DeepSkyStacker* instance)
{
ZASSERT(nullptr == theMainWindow);
theMainWindow = instance;
}

void DeepSkyStacker::setTab(std::uint32_t dwTabID)
{
if (dwTabID == IDD_REGISTERING)
Expand Down Expand Up @@ -538,6 +536,12 @@ void DeepSkyStacker::updateTab()
explorerBar->update();
};

void DeepSkyStacker::reportError(const QString& message, DSSBase::Severity severity)
{
bool result = QMetaObject::invokeMethod(this, "displayMessage", Qt::QueuedConnection,
Q_ARG(const QString&, message),
Q_ARG(QMessageBox::Icon, static_cast<QMessageBox::Icon>(severity) ));
}


BOOL DeepSkyStackerApp::InitInstance()
Expand Down Expand Up @@ -956,7 +960,7 @@ int main(int argc, char* argv[])

ZTRACE_RUNTIME("Creating Main Window");
DeepSkyStacker mainWindow;
DeepSkyStacker::setInstance(&mainWindow);
DSSBase::setInstance(&mainWindow);

ZTRACE_RUNTIME("Checking Mutex");
bip::named_mutex dssMutex{ bip::open_or_create, "DeepSkyStacker.Mutex.UniqueID.12354687" };
Expand Down
18 changes: 12 additions & 6 deletions DeepSkyStacker/DeepSkyStacker.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once
#include "dssbase.h"
#include "dss_settings.h"
/****************************************************************************
**
** Copyright (C) 2020, 2022 David C. Partridge
Expand Down Expand Up @@ -48,7 +50,8 @@ class CDSSSettings;
class CDeepStack;

class DeepSkyStacker :
public QMainWindow
public QMainWindow,
public DSSBase
{
typedef QMainWindow
Inherited;
Expand All @@ -57,7 +60,7 @@ class DeepSkyStacker :

protected slots:
void updateStatus(const QString& text);
void displayMessageBox(const QString& message, QMessageBox::Icon icon);
void displayMessage(const QString& message, QMessageBox::Icon icon);

private:
bool initialised;
Expand All @@ -74,7 +77,7 @@ protected slots:
QString baseTitle;
QString currentPathName;
bool m_progress;
QLabel* statusBarText;
QLabel* statusBarText;

void createStatusBar();
void updateTab();
Expand All @@ -90,14 +93,16 @@ protected slots:
void onInitialise();

public:
static void setInstance(DeepSkyStacker* instance);
inline static DeepSkyStacker* instance()
{
return dynamic_cast<DeepSkyStacker*>(DSSBase::instance());
}

DeepSkyStacker();
~DeepSkyStacker() = default;
~DeepSkyStacker();

inline qreal pixelRatio() { return devicePixelRatioF(); }
inline std::uint32_t tab() { return currTab; }
inline static DeepSkyStacker* instance() { return theMainWindow; }

QString statusMessage();
CDeepStack& deepStack();
Expand All @@ -109,6 +114,7 @@ protected slots:
CProcessingDlg& getProcessingDlg();
ExplorerBar& GetExplorerBar();
void setWindowFilePath(const QString& name);
virtual void reportError(const QString& message, DSSBase::Severity severity);
};


Expand Down
16 changes: 9 additions & 7 deletions DeepSkyStacker/DeepSkyStacker.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<UseDebugLibraries>true</UseDebugLibraries>
Expand All @@ -30,10 +30,10 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreferredToolArchitecture>
</PreferredToolArchitecture>
</PropertyGroup>
Expand Down Expand Up @@ -87,18 +87,19 @@
<HeaderFileName />
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.\;..\ZClass;..\tools;..\LibTIFF;..\CFitsIO;..\Zlib;../libraw;$(Boost_1_80_0);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.\;..\;..\ZClass;..\tools;..\LibTIFF;..\CFitsIO;..\Zlib;../libraw;$(Boost_1_80_0);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_UNICODE;UNICODE;NOMINMAX;LIBRAW_NODLL;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;NDEBUG;_CRT_SECURE_NO_DEPRECATE;USE_LIBTIFF_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
<BufferSecurityCheck>false</BufferSecurityCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>
</DisableSpecificWarnings>
<AdditionalOptions>/openmp:experimental /wd4828</AdditionalOptions>
<EnableModules>false</EnableModules>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down Expand Up @@ -154,14 +155,14 @@ $(QtToolsPath)\windeployqt $(TargetPath)</Command>
<HeaderFileName />
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.\;../Libraw;..\ZClass;..\tools;..\LibTIFF;..\CFitsIO;..\Zlib;$(Boost_1_80_0);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.\;..\;../Libraw;..\ZClass;..\tools;..\LibTIFF;..\CFitsIO;..\Zlib;$(Boost_1_80_0);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_UNICODE;UNICODE;NOMINMAX;LIBRAW_NODLL;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;_DEBUG;_CRT_SECURE_NO_DEPRECATE;USE_LIBTIFF_STATIC;Z_TRACE_DEVELOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/openmp:experimental /wd4828</AdditionalOptions>
<ShowIncludes>false</ShowIncludes>
Expand Down Expand Up @@ -457,6 +458,7 @@ $(QtToolsPath)\windeployqt --pdb $(TargetPath)</Command>
<ResourceCompile Include="DeepSkyStackerTR.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\dssbase.h" />
<ClInclude Include="..\Tools\BitmapSlider.h" />
<ClInclude Include="..\Tools\BtnST.h" />
<ClInclude Include="..\Tools\ButtonToolbar.h" />
Expand Down
5 changes: 4 additions & 1 deletion DeepSkyStacker/DeepSkyStacker.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
Expand Down Expand Up @@ -889,6 +889,9 @@
<ClInclude Include="dslr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\dssbase.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="app.ico">
Expand Down
Loading

0 comments on commit d0e1e38

Please sign in to comment.