Initial commit
This commit is contained in:
commit
5e85543210
12
LICENSE.txt
Normal file
12
LICENSE.txt
Normal file
@ -0,0 +1,12 @@
|
||||
Copyright (c) 2026 Michael Agarkov
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
13
README.md
Normal file
13
README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# URL viewer - preview a URL that is about to open.
|
||||
By [Михаил Агарков](https://codeberg.org/MichaelAgarkov)
|
||||
|
||||
Do you easily get annoyed by programs that open a link in your browser without asking? This program is made specifically to address that.
|
||||
|
||||
## How to use
|
||||
For it to work, you should set it as your default browser. Then, in the program, set the path to the executable of your browser.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> I made this program for my personal use. You may encounter bugs or even crashes, if you do, feel free to report them.
|
||||
|
||||
Licensed under the [0BSD](https://choosealicense.com/licenses/0bsd/).
|
||||
Made with love ^w^
|
||||
80
URLViewer.cbp
Normal file
80
URLViewer.cbp
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="URLViewer" />
|
||||
<Option pch_mode="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/URLViewer" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Option projectLinkerOptionsRelation="2" />
|
||||
<Compiler>
|
||||
<Add option="-O3" />
|
||||
<Add directory="$(#wx)/lib/gcc_dll/mswu" />
|
||||
</Compiler>
|
||||
<ResourceCompiler>
|
||||
<Add directory="$(#wx)/lib/gcc_dll/mswu" />
|
||||
</ResourceCompiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add library="libwxmsw30u_core.a" />
|
||||
<Add library="libwxbase30u.a" />
|
||||
<Add library="libwxpng.a" />
|
||||
<Add library="libwxzlib.a" />
|
||||
<Add directory="$(#wx)/lib/gcc_dll" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-pipe" />
|
||||
<Add option="-mthreads" />
|
||||
<Add option="-D__GNUWIN32__" />
|
||||
<Add option="-D__WXMSW__" />
|
||||
<Add option="-DWXUSINGDLL" />
|
||||
<Add option="-DwxUSE_UNICODE" />
|
||||
<Add option="-Winvalid-pch" />
|
||||
<Add option="-include wx_pch.h" />
|
||||
<Add option="-DWX_PRECOMP" />
|
||||
<Add option="-Wall" />
|
||||
<Add directory="$(#wx)/include" />
|
||||
</Compiler>
|
||||
<ResourceCompiler>
|
||||
<Add directory="$(#wx)/include" />
|
||||
</ResourceCompiler>
|
||||
<Linker>
|
||||
<Add option="-mthreads" />
|
||||
</Linker>
|
||||
<Unit filename="URLViewerApp.cpp" />
|
||||
<Unit filename="URLViewerApp.h" />
|
||||
<Unit filename="URLViewerMain.cpp" />
|
||||
<Unit filename="URLViewerMain.h" />
|
||||
<Unit filename="resource.rc">
|
||||
<Option compilerVar="WINDRES" />
|
||||
</Unit>
|
||||
<Unit filename="version.h" />
|
||||
<Unit filename="wx_pch.h">
|
||||
<Option compile="1" />
|
||||
<Option weight="0" />
|
||||
</Unit>
|
||||
<Unit filename="wxsmith/URLViewerframe.wxs" />
|
||||
<Extensions>
|
||||
<AutoVersioning>
|
||||
<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
|
||||
<Settings autoincrement="1" date_declarations="1" use_define="0" update_manifest="0" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
|
||||
<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
|
||||
<Code header_guard="VERSION_H" namespace="AutoVersion" prefix="" />
|
||||
</AutoVersioning>
|
||||
<lib_finder disable_auto="1" />
|
||||
<wxsmith version="1">
|
||||
<gui name="wxWidgets" src="URLViewerApp.cpp" main="URLViewerFrame" init_handlers="necessary" language="CPP" />
|
||||
<resources>
|
||||
<wxFrame wxs="wxsmith/URLViewerframe.wxs" src="URLViewerMain.cpp" hdr="URLViewerMain.h" fwddecl="0" i18n="1" name="URLViewerFrame" language="CPP" />
|
||||
</resources>
|
||||
</wxsmith>
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
3053
URLViewer.depend
Normal file
3053
URLViewer.depend
Normal file
File diff suppressed because it is too large
Load Diff
25
URLViewer.layout
Normal file
25
URLViewer.layout
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Release" />
|
||||
<File name="URLViewerApp.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="392" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="URLViewerMain.cpp" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="393" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="URLViewerMain.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="787" topLine="29" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="resource.rc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="49" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
||||
33
URLViewerApp.cpp
Normal file
33
URLViewerApp.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
/***************************************************************
|
||||
* Name: URLViewerApp.cpp
|
||||
* Purpose: Code for Application Class
|
||||
* Author: Michael Agarkov (michaelagarkov@michaelagarkov.ru)
|
||||
* Created: 2026-05-16
|
||||
* Copyright: Michael Agarkov (https://michaelagarkov.ru/MichaelAgarkov)
|
||||
* License: 0BSD
|
||||
**************************************************************/
|
||||
|
||||
#include "wx_pch.h"
|
||||
#include "URLViewerApp.h"
|
||||
|
||||
//(*AppHeaders
|
||||
#include "URLViewerMain.h"
|
||||
#include <wx/image.h>
|
||||
//*)
|
||||
|
||||
IMPLEMENT_APP(URLViewerApp);
|
||||
|
||||
bool URLViewerApp::OnInit() {
|
||||
wxString cliArg;
|
||||
if (argc > 1) {
|
||||
cliArg = argv[1];
|
||||
}
|
||||
bool wxsOK = true;
|
||||
wxInitAllImageHandlers();
|
||||
if (wxsOK) {
|
||||
URLViewerFrame* frame = new URLViewerFrame(nullptr, cliArg);
|
||||
frame->Show();
|
||||
SetTopWindow(frame);
|
||||
}
|
||||
return wxsOK;
|
||||
}
|
||||
20
URLViewerApp.h
Normal file
20
URLViewerApp.h
Normal file
@ -0,0 +1,20 @@
|
||||
/***************************************************************
|
||||
* Name: URLViewerApp.h
|
||||
* Purpose: Defines Application Class
|
||||
* Author: Michael Agarkov (michaelagarkov@michaelagarkov.ru)
|
||||
* Created: 2026-05-16
|
||||
* Copyright: Michael Agarkov (https://michaelagarkov.ru/MichaelAgarkov)
|
||||
* License: 0BSD
|
||||
**************************************************************/
|
||||
|
||||
#ifndef URLVIEWERAPP_H
|
||||
#define URLVIEWERAPP_H
|
||||
|
||||
#include <wx/app.h>
|
||||
|
||||
class URLViewerApp : public wxApp {
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
};
|
||||
|
||||
#endif // URLVIEWERAPP_H
|
||||
160
URLViewerMain.cpp
Normal file
160
URLViewerMain.cpp
Normal file
@ -0,0 +1,160 @@
|
||||
/***************************************************************
|
||||
* Name: URLViewerMain.cpp
|
||||
* Purpose: Code for Application Frame
|
||||
* Author: Michael Agarkov (michaelagarkov@michaelagarkov.ru)
|
||||
* Created: 2026-05-16
|
||||
* Copyright: Michael Agarkov (https://michaelagarkov.ru/MichaelAgarkov)
|
||||
* License: 0BSD
|
||||
**************************************************************/
|
||||
|
||||
#include "wx_pch.h"
|
||||
#include "URLViewerMain.h"
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/utils.h>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include "version.h"
|
||||
|
||||
//(*InternalHeaders(URLViewerFrame)
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
//*)
|
||||
|
||||
//helper functions
|
||||
enum wxbuildinfoformat {
|
||||
short_f, long_f
|
||||
};
|
||||
|
||||
wxString wxbuildinfo(wxbuildinfoformat format) {
|
||||
wxString wxbuild(wxVERSION_STRING);
|
||||
|
||||
if (format == long_f ) {
|
||||
#if defined(__WXMSW__)
|
||||
wxbuild << _T("-Windows");
|
||||
#elif defined(__UNIX__)
|
||||
wxbuild << _T("-Linux");
|
||||
#endif
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxbuild << _T("-Unicode build");
|
||||
#else
|
||||
wxbuild << _T("-ANSI build");
|
||||
#endif // wxUSE_UNICODE
|
||||
}
|
||||
|
||||
return wxbuild;
|
||||
}
|
||||
|
||||
wxString getDefaultBrowser() {
|
||||
std::ifstream file("defaultBrowserSet.conf");
|
||||
if (!file) {
|
||||
throw std::runtime_error("Failed to open default browser setting file");
|
||||
}
|
||||
|
||||
std::stringstream buffer;
|
||||
buffer << file.rdbuf();
|
||||
return wxString(buffer.str());
|
||||
}
|
||||
|
||||
//(*IdInit(URLViewerFrame)
|
||||
const long URLViewerFrame::ID_STATICTEXT1 = wxNewId();
|
||||
const long URLViewerFrame::ID_TEXTCTRL1 = wxNewId();
|
||||
const long URLViewerFrame::ID_BUTTON1 = wxNewId();
|
||||
const long URLViewerFrame::ID_BUTTON2 = wxNewId();
|
||||
const long URLViewerFrame::ID_PANEL1 = wxNewId();
|
||||
const long URLViewerFrame::idMenuSetBrowser = wxNewId();
|
||||
const long URLViewerFrame::idMenuAbout = wxNewId();
|
||||
//*)
|
||||
|
||||
BEGIN_EVENT_TABLE(URLViewerFrame,wxFrame)
|
||||
//(*EventTable(URLViewerFrame)
|
||||
//*)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
URLViewerFrame::URLViewerFrame(wxWindow* parent, const wxString& cliArg) {
|
||||
int id {0};
|
||||
//(*Initialize(URLViewerFrame)
|
||||
wxMenu* Menu1;
|
||||
wxMenu* Menu2;
|
||||
wxMenuBar* MenuBar1;
|
||||
wxMenuItem* MenuItem1;
|
||||
wxMenuItem* MenuItem2;
|
||||
|
||||
Create(parent, id, _("URL viewer"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
|
||||
SetClientSize(wxSize(385,120));
|
||||
{
|
||||
wxIcon FrameIcon;
|
||||
FrameIcon.CopyFromBitmap(wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_WARNING")),wxART_MAKE_CLIENT_ID_FROM_STR(wxString(_T("wxART_MESSAGE_BOX")))));
|
||||
SetIcon(FrameIcon);
|
||||
}
|
||||
Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(232,248), wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
|
||||
AboveURLStaticText = new wxStaticText(Panel1, ID_STATICTEXT1, _("You are about to visit:"), wxPoint(8,8), wxDefaultSize, 0, _T("ID_STATICTEXT1"));
|
||||
UrlText = new wxTextCtrl(Panel1, ID_TEXTCTRL1, _("URL"), wxPoint(8,24), wxSize(368,23), 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
|
||||
UrlText->Disable();
|
||||
OpenButton = new wxButton(Panel1, ID_BUTTON1, _("Open in browser"), wxPoint(8,64), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
|
||||
CancelButton = new wxButton(Panel1, ID_BUTTON2, _("Cancel"), wxPoint(288,64), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
|
||||
MenuBar1 = new wxMenuBar();
|
||||
Menu1 = new wxMenu();
|
||||
MenuItem1 = new wxMenuItem(Menu1, idMenuSetBrowser, _("Set default browser"), _("Set the default browser"), wxITEM_NORMAL);
|
||||
Menu1->Append(MenuItem1);
|
||||
MenuBar1->Append(Menu1, _("&Settings"));
|
||||
Menu2 = new wxMenu();
|
||||
MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this program"), wxITEM_NORMAL);
|
||||
Menu2->Append(MenuItem2);
|
||||
MenuBar1->Append(Menu2, _("Help"));
|
||||
SetMenuBar(MenuBar1);
|
||||
Center();
|
||||
|
||||
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&URLViewerFrame::OnOpenButtonClick);
|
||||
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&URLViewerFrame::OnCancelButtonClick);
|
||||
Connect(idMenuSetBrowser,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&URLViewerFrame::OnSetBrowser);
|
||||
Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&URLViewerFrame::OnAbout);
|
||||
//*)
|
||||
UrlText->SetValue(cliArg);
|
||||
}
|
||||
|
||||
URLViewerFrame::~URLViewerFrame() {
|
||||
//(*Destroy(URLViewerFrame)
|
||||
//*)
|
||||
}
|
||||
|
||||
void URLViewerFrame::OnSetBrowser(wxCommandEvent& event) {
|
||||
wxTextEntryDialog defaultBrowserSetDlg(this,
|
||||
"Path to the executable of the default browser:",
|
||||
"Enter path",
|
||||
"",
|
||||
wxOK | wxCANCEL);
|
||||
if (defaultBrowserSetDlg.ShowModal() != wxID_OK)
|
||||
return;
|
||||
wxString browserPathString = defaultBrowserSetDlg.GetValue();
|
||||
std::ofstream settingFile("defaultBrowserSet.conf");
|
||||
if (!settingFile) return;
|
||||
settingFile << browserPathString;
|
||||
settingFile.close();
|
||||
}
|
||||
|
||||
void URLViewerFrame::OnAbout(wxCommandEvent& event) {
|
||||
wxString msg;
|
||||
msg << "URL viewer\nVersion ";
|
||||
msg << AutoVersion::MAJOR << "." << AutoVersion::MINOR;
|
||||
msg << "\n\nBy Ìèõàèë Àãàðêîâ\n\nUses ";
|
||||
msg << wxbuildinfo(long_f);
|
||||
wxMessageBox(msg, _("About URL viewer"));
|
||||
}
|
||||
|
||||
void URLViewerFrame::OnOpenButtonClick(wxCommandEvent& event) {
|
||||
wxString url = UrlText->GetValue().Trim();
|
||||
if (!url.IsEmpty()) {
|
||||
wxString cmd = wxString::Format("\"%s\" \"%s\"", getDefaultBrowser(), url);
|
||||
wxExecute(cmd, wxEXEC_ASYNC);
|
||||
}
|
||||
Close();
|
||||
}
|
||||
|
||||
void URLViewerFrame::OnCancelButtonClick(wxCommandEvent& event) {
|
||||
Close();
|
||||
}
|
||||
59
URLViewerMain.h
Normal file
59
URLViewerMain.h
Normal file
@ -0,0 +1,59 @@
|
||||
/***************************************************************
|
||||
* Name: URLViewerMain.h
|
||||
* Purpose: Defines Application Frame
|
||||
* Author: Michael Agarkov (michaelagarkov@michaelagarkov.ru)
|
||||
* Created: 2026-05-16
|
||||
* Copyright: Michael Agarkov (https://michaelagarkov.ru/MichaelAgarkov)
|
||||
* License: 0BSD
|
||||
**************************************************************/
|
||||
|
||||
#ifndef URLVIEWERMAIN_H
|
||||
#define URLVIEWERMAIN_H
|
||||
|
||||
//(*Headers(URLViewerFrame)
|
||||
#include <wx/button.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
//*)
|
||||
|
||||
class URLViewerFrame: public wxFrame {
|
||||
public:
|
||||
|
||||
URLViewerFrame(wxWindow* parent, const wxString& cliArg = wxEmptyString);
|
||||
virtual ~URLViewerFrame();
|
||||
|
||||
private:
|
||||
wxString m_cliArg;
|
||||
|
||||
//(*Handlers(URLViewerFrame)
|
||||
void OnSetBrowser(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnOpenButtonClick(wxCommandEvent& event);
|
||||
void OnCancelButtonClick(wxCommandEvent& event);
|
||||
//*)
|
||||
|
||||
//(*Identifiers(URLViewerFrame)
|
||||
static const long ID_STATICTEXT1;
|
||||
static const long ID_TEXTCTRL1;
|
||||
static const long ID_BUTTON1;
|
||||
static const long ID_BUTTON2;
|
||||
static const long ID_PANEL1;
|
||||
static const long idMenuSetBrowser;
|
||||
static const long idMenuAbout;
|
||||
//*)
|
||||
|
||||
//(*Declarations(URLViewerFrame)
|
||||
wxButton* CancelButton;
|
||||
wxButton* OpenButton;
|
||||
wxPanel* Panel1;
|
||||
wxStaticText* AboveURLStaticText;
|
||||
wxTextCtrl* UrlText;
|
||||
//*)
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // URLVIEWERMAIN_H
|
||||
BIN
bin/Release/URLViewer.exe
Normal file
BIN
bin/Release/URLViewer.exe
Normal file
Binary file not shown.
BIN
bin/Release/wxbase30u_gcc_custom.dll
Normal file
BIN
bin/Release/wxbase30u_gcc_custom.dll
Normal file
Binary file not shown.
BIN
bin/Release/wxmsw30u_core_gcc_custom.dll
Normal file
BIN
bin/Release/wxmsw30u_core_gcc_custom.dll
Normal file
Binary file not shown.
BIN
icon.ico
Normal file
BIN
icon.ico
Normal file
Binary file not shown.
|
After Width: 64px | Height: 64px | Size: 17 KiB |
84
installer.iss
Normal file
84
installer.iss
Normal file
@ -0,0 +1,84 @@
|
||||
[Setup]
|
||||
AppId={{0A850D90-3F5F-4E89-BAB6-C2C206FAA915}
|
||||
AppName=URL viewer
|
||||
AppVersion=1.0
|
||||
AppPublisher=MichaelAgarkov
|
||||
AppPublisherURL=https://michaelagarkov.ru/MichaelAgarkov
|
||||
DefaultDirName={autopf}\URL viewer
|
||||
DefaultGroupName=URL viewer
|
||||
LicenseFile=LICENSE.txt
|
||||
PrivilegesRequiredOverridesAllowed=commandline
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=classic
|
||||
|
||||
[Types]
|
||||
Name: "full"; Description: "With wxWidgets"
|
||||
Name: "compact"; Description: "I'll provide my own wxWidgets DLLs"
|
||||
Name: "custom"; Description: "Custom installation"; Flags: iscustom
|
||||
|
||||
[Components]
|
||||
Name: "main"; Description: "URLViewer"; Types: full compact custom; Flags: fixed
|
||||
Name: "wx"; Description: "wxWidgets DLLs required"; Types: full
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Files]
|
||||
Source: "bin\Release\URLViewer.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: main
|
||||
Source: "bin\Release\wxbase30u_gcc_custom.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: wx
|
||||
Source: "bin\Release\wxmsw30u_core_gcc_custom.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: wx
|
||||
|
||||
[Registry]
|
||||
Root: HKCR; Subkey: "URLViewer"; ValueType: string; ValueName: ""; ValueData: "URL viewer"; Flags: uninsdeletekey
|
||||
Root: HKCR; Subkey: "URLViewer\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\URLViewer.exe,0"
|
||||
Root: HKCR; Subkey: "URLViewer\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\URLViewer.exe"" ""%1"""
|
||||
Root: HKLM; Subkey: "SOFTWARE\RegisteredApplications"; ValueType: string; ValueName: "URLViewer"; ValueData: "Software\URLViewer\Capabilities"
|
||||
Root: HKLM; Subkey: "SOFTWARE\URLViewer\Capabilities"; ValueType: string; ValueName: "ApplicationDescription"; ValueData: "Preview a URL that is about to open."
|
||||
Root: HKLM; Subkey: "SOFTWARE\URLViewer\Capabilities\URLAssociations"; ValueType: string; ValueName: "http"; ValueData: "URLViewer"
|
||||
Root: HKLM; Subkey: "SOFTWARE\URLViewer\Capabilities\URLAssociations"; ValueType: string; ValueName: "https"; ValueData: "URLViewer"
|
||||
|
||||
[Code]
|
||||
var
|
||||
DefaultBrowserPage: TWizardPage;
|
||||
DefaultBrowserCheckBox: TNewCheckBox;
|
||||
|
||||
procedure InitializeWizard;
|
||||
begin
|
||||
DefaultBrowserPage := CreateCustomPage(wpSelectTasks, 'Set as default browser', 'Set URL viewer as the default browser?');
|
||||
DefaultBrowserCheckBox := TNewCheckBox.Create(DefaultBrowserPage);
|
||||
DefaultBrowserCheckBox.Parent := DefaultBrowserPage.Surface;
|
||||
DefaultBrowserCheckBox.Caption := 'Set URL viewer as the default browser';
|
||||
DefaultBrowserCheckBox.Checked := True;
|
||||
DefaultBrowserCheckBox.Top := 0;
|
||||
DefaultBrowserCheckBox.Left := 0;
|
||||
DefaultBrowserCheckBox.Width := DefaultBrowserPage.SurfaceWidth;
|
||||
DefaultBrowserCheckBox.Height := ScaleY(30);
|
||||
end;
|
||||
|
||||
procedure OpenDefaultAppsSettings;
|
||||
var
|
||||
ErrorCode: Integer;
|
||||
begin
|
||||
if not ShellExec('open', 'ms-settings:defaultapps', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode) then
|
||||
begin
|
||||
if not ShellExec('open', 'control.exe', '/name Microsoft.DefaultPrograms /page pageDefaultPrograms', '', SW_SHOWNORMAL, ewNoWait, ErrorCode) then
|
||||
begin
|
||||
MsgBox('Unable to open default apps settings.', mbError, MB_OK);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CurStepChanged(CurStep: TSetupStep);
|
||||
begin
|
||||
if CurStep = ssDone then
|
||||
begin
|
||||
if DefaultBrowserCheckBox.Checked then
|
||||
begin
|
||||
if MsgBox('Open settings to set URL viewer as your default browser?', mbConfirmation, MB_YESNO) = IDYES then
|
||||
begin
|
||||
OpenDefaultAppsSettings;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
BIN
obj/Release/URLViewerApp.o
Normal file
BIN
obj/Release/URLViewerApp.o
Normal file
Binary file not shown.
BIN
obj/Release/URLViewerMain.o
Normal file
BIN
obj/Release/URLViewerMain.o
Normal file
Binary file not shown.
BIN
obj/Release/resource.res
Normal file
BIN
obj/Release/resource.res
Normal file
Binary file not shown.
3
resource.rc
Normal file
3
resource.rc
Normal file
@ -0,0 +1,3 @@
|
||||
aaaa ICON "icon.ico"
|
||||
|
||||
#include "wx/msw/wx.rc"
|
||||
33
version.h
Normal file
33
version.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
namespace AutoVersion{
|
||||
|
||||
//Date Version Types
|
||||
static const char DATE[] = "16";
|
||||
static const char MONTH[] = "05";
|
||||
static const char YEAR[] = "2026";
|
||||
static const char UBUNTU_VERSION_STYLE[] = "26.05";
|
||||
|
||||
//Software Status
|
||||
static const char STATUS[] = "Release";
|
||||
static const char STATUS_SHORT[] = "r";
|
||||
|
||||
//Standard Version Type
|
||||
static const long MAJOR = 1;
|
||||
static const long MINOR = 0;
|
||||
static const long BUILD = 0;
|
||||
static const long REVISION = 0;
|
||||
|
||||
//Miscellaneous Version Types
|
||||
static const long BUILDS_COUNT = 1;
|
||||
#define RC_FILEVERSION 1,0,0,0
|
||||
#define RC_FILEVERSION_STRING "1, 0, 0, 0\0"
|
||||
static const char FULLVERSION_STRING [] = "1.0.0.0";
|
||||
|
||||
//These values are to keep track of your versioning state, don't modify them.
|
||||
static const long BUILD_HISTORY = 0;
|
||||
|
||||
|
||||
}
|
||||
#endif //VERSION_H
|
||||
28
wx_pch.h
Normal file
28
wx_pch.h
Normal file
@ -0,0 +1,28 @@
|
||||
/***************************************************************
|
||||
* Name: wx_pch.h
|
||||
* Purpose: Header to create Pre-Compiled Header (PCH)
|
||||
* Author: Michael Agarkov (michaelagarkov@michaelagarkov.ru)
|
||||
* Created: 2026-05-16
|
||||
* Copyright: Michael Agarkov (https://michaelagarkov.ru/MichaelAgarkov)
|
||||
* License: 0BSD
|
||||
**************************************************************/
|
||||
|
||||
#ifndef WX_PCH_H_INCLUDED
|
||||
#define WX_PCH_H_INCLUDED
|
||||
|
||||
// basic wxWidgets headers
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#ifdef WX_PRECOMP
|
||||
// put here all your rarely-changing header files
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#endif // WX_PCH_H_INCLUDED
|
||||
BIN
wx_pch.h.gch/Release_wx_pch_h_gch
Normal file
BIN
wx_pch.h.gch/Release_wx_pch_h_gch
Normal file
Binary file not shown.
51
wxsmith/URLViewerframe.wxs
Normal file
51
wxsmith/URLViewerframe.wxs
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<wxsmith>
|
||||
<object class="wxFrame" name="URLViewerFrame">
|
||||
<title>URL viewer</title>
|
||||
<centered>1</centered>
|
||||
<icon stock_id="wxART_WARNING" stock_client="wxART_MESSAGE_BOX" />
|
||||
<size>385,120</size>
|
||||
<object class="wxPanel" name="ID_PANEL1" variable="Panel1" member="yes">
|
||||
<pos>232,248</pos>
|
||||
<object class="wxStaticText" name="ID_STATICTEXT1" variable="AboveURLStaticText" member="yes">
|
||||
<label>You are about to visit:</label>
|
||||
<pos>8,8</pos>
|
||||
</object>
|
||||
<object class="wxTextCtrl" name="ID_TEXTCTRL1" variable="UrlText" member="yes">
|
||||
<value>URL</value>
|
||||
<pos>8,24</pos>
|
||||
<size>368,23</size>
|
||||
<enabled>0</enabled>
|
||||
</object>
|
||||
<object class="wxButton" name="ID_BUTTON1" variable="OpenButton" member="yes">
|
||||
<label>Open in browser</label>
|
||||
<pos>8,64</pos>
|
||||
<handler function="OnOpenButtonClick" entry="EVT_BUTTON" />
|
||||
</object>
|
||||
<object class="wxButton" name="ID_BUTTON2" variable="CancelButton" member="yes">
|
||||
<label>Cancel</label>
|
||||
<pos>288,64</pos>
|
||||
<handler function="OnCancelButtonClick" entry="EVT_BUTTON" />
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxMenuBar" variable="MenuBar1" member="no">
|
||||
<object class="wxMenu" variable="Menu1" member="no">
|
||||
<label>&Settings</label>
|
||||
<object class="wxMenuItem" name="idMenuSetBrowser" variable="MenuItem1" member="no">
|
||||
<label>Set default browser</label>
|
||||
<help>Set the default browser</help>
|
||||
<handler function="OnSetBrowser" entry="EVT_MENU" />
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxMenu" variable="Menu2" member="no">
|
||||
<label>Help</label>
|
||||
<object class="wxMenuItem" name="idMenuAbout" variable="MenuItem2" member="no">
|
||||
<label>About</label>
|
||||
<accel>F1</accel>
|
||||
<help>Show info about this program</help>
|
||||
<handler function="OnAbout" entry="EVT_MENU" />
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxsmith>
|
||||
Loading…
Reference in New Issue
Block a user