new db error window

This commit is contained in:
Petr Hlozek 2016-03-11 18:59:40 +01:00
parent 67cb8e81d0
commit 05ef962780
9 changed files with 279 additions and 37 deletions

View File

@ -10,6 +10,8 @@ Legend:
+ list of previous QSO should be much faster on older computers
+ "Always overwrite only CQ, ITU zones, county and US state from callbook" option added
+ callbook is used for better DXCC and state recognition
+ new database connection error window with small how to
+ the db error window can open mysql.err
- CW type window was not sizeable - fixed
- password to LoTW/eQSL could not have special characters - fixed
- program crashed after opening Preferences when path to rigctl was empty - fixed

View File

@ -82,7 +82,7 @@
<MinVersion Major="1" Minor="2" Release="1" Valid="True"/>
</Item10>
</RequiredPackages>
<Units Count="89">
<Units Count="90">
<Unit0>
<Filename Value="cqrlog.lpr"/>
<IsPartOfProject Value="True"/>
@ -653,6 +653,13 @@
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
</Unit88>
<Unit89>
<Filename Value="fdberror.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmDbError"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fDbError"/>
</Unit89>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -19,7 +19,7 @@ uses
feQSLUpload,fSOTAExport, fNewQSODefValues, fQSLExpPref, fRotControl,
dLogUpload, fLogUploadStatus,frCWKeys, fCallAlert, fNewCallAlert,
fConfigStorage, fRbnFilter, fRbnMonitor, fRbnServer, fRadioMemories,
fAddRadioMemory, fException;
fAddRadioMemory, fException, fDbError;
var
Splash : TfrmSplash;

View File

@ -329,6 +329,7 @@ type
procedure GetPreviousFreqFromMem(var freq : Double; var mode : String; var bandwidth : Integer);
procedure GetNextFreqFromMem(var freq : Double; var mode : String; var bandwidth : Integer);
procedure OpenFreqMemories(mode : String);
procedure CheckApparmorConfig;
end;
var
@ -340,7 +341,7 @@ var
implementation
uses dUtils, dDXCC, fMain, fWorking, fUpgrade, fImportProgress, fNewQSO, dDXCluster, uMyIni,
fTRXControl, fRotControl, uVersion, dLogUpload;
fTRXControl, fRotControl, uVersion, dLogUpload, fDbError;
procedure TdmData.CheckForDatabases;
var
@ -3417,36 +3418,7 @@ begin
if FileExistsUTF8('/usr/sbin/mysqld') then //openSUSE
Result := '/usr/sbin/mysqld';
if Result = '' then //don't know where mysqld is, so hopefully will be in $PATH
Result := 'mysqld';
if FileExistsUTF8('/etc/apparmor.d/usr.sbin.mysqld') then
begin
l := TStringList.Create;
try
l.LoadFromFile('/etc/apparmor.d/usr.sbin.mysqld');
l.Text := UpperCase(l.Text);
if Pos(UpperCase('@{HOME}/.config/cqrlog/database/** rwk,'),l.Text) = 0 then
begin
info := 'It looks like apparmor is running in your system. CQRLOG needs to add this :'+
LineEnding+
'@{HOME}/.config/cqrlog/database/** rwk,'+
LineEnding+
'into /etc/apparmor.d/usr.sbin.mysqld'+
LineEnding+
LineEnding+
'You can do that by running /usr/share/cqrlog/cqrlog-apparmor-fix or you can add the line '+
'and restart apparmor manually.'+
LineEnding+
LineEnding+
'Click OK to continue (program may not work correctly) or Cancel and modify the file '+
'first.';
if Application.MessageBox(PChar(info),'Information ...',mb_OKCancel+mb_IconInformation) = idCancel then
Application.Terminate
end
finally
l.Free
end
end
Result := 'mysqld'
end;
procedure TdmData.PrepareMysqlConfigFile;
@ -3527,8 +3499,12 @@ begin
MainCon.DatabaseName := '';
if not Connected then
begin
Application.MessageBox('MySQL could not be started, please check if the MySQL server is installed properly','Error...',
mb_OK + mb_IconError)
with TfrmDbError.Create(nil) do
try
ShowModal
finally
Free
end
end
end;
@ -4241,6 +4217,58 @@ begin
GetCurrentFreqFromMem(freq,mode,bandwidth)
end;
procedure TdmData.CheckApparmorConfig;
function IsModified(FileName : String) : Boolean;
var
l : TStringList;
begin
Result := False;
l := TStringList.Create;
try
l.LoadFromFile(FileName);
l.Text := UpperCase(l.Text);
if Pos(UpperCase('@{HOME}/.config/cqrlog/database/** rwk,'),l.Text) = 0 then
Result := True
finally
l.Free
end
end;
var
ShowInfo : Boolean = False;
MsgText : String = '';
begin
Writeln('Checking apparmor configuration');
if FileExistsUTF8('/etc/apparmor.d/usr.sbin.mysqld') then
begin
ShowInfo := IsModified('/etc/apparmor.d/usr.sbin.mysqld')
end;
if FileExistsUTF8('/etc/apparmor.d/local/usr.sbin.mysqld') then //debian
begin
ShowInfo := IsModified('/etc/apparmor.d/usr.sbin.mysqld')
end;
MsgText := 'It looks like apparmor is running in your system. CQRLOG needs to add this :'+
LineEnding+
'@{HOME}/.config/cqrlog/database/** rwk,'+
LineEnding+
'into /etc/apparmor.d/usr.sbin.mysqld'+
LineEnding+
LineEnding+
'You can do that by running /usr/share/cqrlog/cqrlog-apparmor-fix or you can add the line '+
'and restart apparmor manually.'+
LineEnding+
LineEnding+
'Click OK to continue (program may not work correctly) or Cancel and modify the file '+
'first.';
if Application.MessageBox(PChar(MsgText),'Information ...',mb_OKCancel+mb_IconInformation) = idCancel then
Application.Terminate
end;
initialization
{$I dData.lrs}

View File

@ -9,7 +9,7 @@ object frmDBConnect: TfrmDBConnect
OnClose = FormClose
OnCreate = FormCreate
OnShow = FormShow
LCLVersion = '1.2.4.0'
LCLVersion = '1.4.4.0'
object grbLogin: TGroupBox
Left = 0
Height = 192

View File

@ -4,7 +4,7 @@ LazarusResources.Add('TfrmDBConnect','FORMDATA',[
'TPF0'#13'TfrmDBConnect'#12'frmDBConnect'#4'Left'#3#243#1#6'Height'#3'('#2#3
+'Top'#3#194#0#5'Width'#3'q'#1#7'Caption'#6#19'Database connection'#12'Client'
+'Height'#3'('#2#11'ClientWidth'#3'q'#1#7'OnClose'#7#9'FormClose'#8'OnCreate'
+#7#10'FormCreate'#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#7'1.2.4.0'#0#9'TG'
+#7#10'FormCreate'#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#7'1.4.4.0'#0#9'TG'
+'roupBox'#8'grbLogin'#4'Left'#2#0#6'Height'#3#192#0#3'Top'#2#0#5'Width'#3'q'
+#1#5'Align'#7#5'alTop'#7'Caption'#6#14' MySQL server '#12'ClientHeight'#3#173
+#0#11'ClientWidth'#3'm'#1#8'TabOrder'#2#0#7'Visible'#8#0#5'TEdit'#9'edtServe'

83
src/fDbError.lfm Normal file
View File

@ -0,0 +1,83 @@
object frmDbError: TfrmDbError
Left = 804
Height = 196
Top = 412
Width = 442
Caption = 'Database problem'
ClientHeight = 196
ClientWidth = 442
Position = poDesktopCenter
LCLVersion = '1.4.4.0'
object Label1: TLabel
Left = 8
Height = 119
Top = 8
Width = 428
Caption = 'MySQL could not be started, please check if the MySQL server is '#10'installed properly.'#10#10'Please look at https://www.cqrlog.com/faq'#10#10'If you don''t find the answer, ask in CQRLOG forum and attach '#10'last 20 lines from the mysql.err file.'
ParentColor = False
end
object btnOpenErrFile: TButton
Left = 255
Height = 25
Top = 129
Width = 171
Caption = 'Open mysql.err file'
OnClick = btnOpenErrFileClick
TabOrder = 0
end
object Button2: TButton
Left = 168
Height = 25
Top = 168
Width = 75
Cancel = True
Caption = 'Close'
ModalResult = 2
TabOrder = 1
end
object btnVisitFAQ: TBitBtn
Left = 309
Height = 30
Top = 53
Width = 128
Caption = 'Open website'
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00145D9503105A921AFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF0022669E061B629AAD22679DFF115B9387FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF003272
AA062B6DA5AD558DBCFF89B5DDFF185F97FFFFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00447FB7063C79
B1AD6497C5FF9DC1E4FF6699C7FF1F659DEBFFFFFF00FFFFFF00FFFFFF00FFFF
FF00DDB28F02D9AE8A97D6A985E3D3A57FFDD0A07BFDCD9C76E4A2938ADE75A2
CCFFABCBE8FF76A4CEFF3070A8EB286BA327FFFFFF00FFFFFF00FFFFFF00E4BD
9B02E1B896C0E8C9AEFFF5E1CDFFF7E5D3FFF7E5D1FFF3DDC8FFDFBA9CFFC7A8
91FF86AED5FF417DB5EB3977AF27FFFFFF00FFFFFF00FFFFFF00FFFFFF00E8C3
A297EDD0B7FFF8E8D9FFF5DEC8FFF3D8BDFFF3D6BBFFF4DBC2FFF7E4D2FFDFBB
9DFF9D9492F74B84BC27FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00ECC8
A8E3F7E7D7FFF6E1CCFFF4DBC2FFF4DAC0FFF3D8BDFFF3D7BBFFF4DBC2FFF3DE
C9FFCD9F7BE7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00F0CE
AEFDF9ECDFFFF5DFC8FFF5DDC6FFF4DCC3FFF4DAC1FFF3D9BEFFF3D7BDFFF8E6
D3FFD3A57FFDFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00F4D3
B4FDF9EDE1FFF6E1CCFFF5DFC9FFF5DEC7FFF4DCC4FFF4DBC2FFF4DAC0FFF8E7
D6FFD7AA86FDFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00F7D7
B9E3F9EBDEFFF7E7D6FFF6E1CCFFF5E0CAFFF5DEC8FFF5DDC5FFF6E1CBFFF5E2
D0FFDBB08CE3FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FADB
BD97F8E2CCFFFAEEE3FFF7E7D6FFF6E2CEFFF6E1CBFFF6E3D0FFF9EADDFFECCF
B5FFDFB69397FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FCDE
C002FADBBEC0F9E2CDFFFAECDEFFF9EEE2FFF9EDE2FFF8E9DAFFF0D5BDFFE7C0
9FC0E3BC9A02FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FCDEC102FADCBF97F9D9BBE3F6D6B8FDF4D3B4FDF1CFAFE3EECBAB97EBC6
A602FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = btnVisitFAQClick
TabOrder = 2
end
end

71
src/fDbError.lrs Normal file
View File

@ -0,0 +1,71 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TfrmDbError','FORMDATA',[
'TPF0'#11'TfrmDbError'#10'frmDbError'#4'Left'#3'$'#3#6'Height'#3#196#0#3'Top'
+#3#156#1#5'Width'#3#186#1#7'Caption'#6#16'Database problem'#12'ClientHeight'
+#3#196#0#11'ClientWidth'#3#186#1#8'Position'#7#15'poDesktopCenter'#10'LCLVer'
+'sion'#6#7'1.4.4.0'#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2'w'#3'Top'#2
+#8#5'Width'#3#172#1#7'Caption'#6#229'MySQL could not be started, please chec'
+'k if the MySQL server is '#10'installed properly.'#10#10'Please look at htt'
+'ps://www.cqrlog.com/faq'#10#10'If you don''t find the answer, ask in CQRLOG'
+' forum and attach '#10'last 20 lines from the mysql.err file.'#11'ParentCol'
+'or'#8#0#0#7'TButton'#14'btnOpenErrFile'#4'Left'#3#255#0#6'Height'#2#25#3'To'
+'p'#3#129#0#5'Width'#3#171#0#7'Caption'#6#19'Open mysql.err file'#7'OnClick'
+#7#19'btnOpenErrFileClick'#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'
+#3#168#0#6'Height'#2#25#3'Top'#3#168#0#5'Width'#2'K'#6'Cancel'#9#7'Caption'#6
+#5'Close'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#7'TBitBtn'#11'btnVisitFAQ'
+#4'Left'#3'5'#1#6'Height'#2#30#3'Top'#2'5'#5'Width'#3#128#0#7'Caption'#6#12
+'Open website'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0
+#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0
+#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#20']'#149#3#16'Z'#146#26#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'"f'
+#158#6#27'b'#154#173'"g'#157#255#17'['#147#135#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'2r'#170#6'+m'#165#173'U'
+#141#188#255#137#181#221#255#24'_'#151#255#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0'D'#127#183#6'<y'#177#173'd'#151#197#255
+#157#193#228#255'f'#153#199#255#31'e'#157#235#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#221#178#143#2#217#174#138#151#214#169#133#227#211
+#165#127#253#208#160'{'#253#205#156'v'#228#162#147#138#222'u'#162#204#255#171
+#203#232#255'v'#164#206#255'0p'#168#235'(k'#163''''#255#255#255#0#255#255#255
+#0#255#255#255#0#228#189#155#2#225#184#150#192#232#201#174#255#245#225#205
+#255#247#229#211#255#247#229#209#255#243#221#200#255#223#186#156#255#199#168
+#145#255#134#174#213#255'A}'#181#235'9w'#175''''#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#232#195#162#151#237#208#183#255#248#232#217#255
+#245#222#200#255#243#216#189#255#243#214#187#255#244#219#194#255#247#228#210
+#255#223#187#157#255#157#148#146#247'K'#132#188''''#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#236#200#168#227#247#231#215#255
+#246#225#204#255#244#219#194#255#244#218#192#255#243#216#189#255#243#215#187
+#255#244#219#194#255#243#222#201#255#205#159'{'#231#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#240#206#174#253
+#249#236#223#255#245#223#200#255#245#221#198#255#244#220#195#255#244#218#193
+#255#243#217#190#255#243#215#189#255#248#230#211#255#211#165#127#253#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#244#211#180#253#249#237#225#255#246#225#204#255#245#223#201#255#245#222#199
+#255#244#220#196#255#244#219#194#255#244#218#192#255#248#231#214#255#215#170
+#134#253#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0#247#215#185#227#249#235#222#255#247#231#214#255#246#225#204
+#255#245#224#202#255#245#222#200#255#245#221#197#255#246#225#203#255#245#226
+#208#255#219#176#140#227#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#250#219#189#151#248#226#204#255#250#238
+#227#255#247#231#214#255#246#226#206#255#246#225#203#255#246#227#208#255#249
+#234#221#255#236#207#181#255#223#182#147#151#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#252#222#192#2#250#219
+#190#192#249#226#205#255#250#236#222#255#249#238#226#255#249#237#226#255#248
+#233#218#255#240#213#189#255#231#192#159#192#227#188#154#2#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#252#222#193#2#250#220#191#151#249#217#187#227#246#214#184#253#244#211
+#180#253#241#207#175#227#238#203#171#151#235#198#166#2#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#7'OnClick'#7
+#16'btnVisitFAQClick'#8'TabOrder'#2#2#0#0#0
]);

51
src/fDbError.pas Normal file
View File

@ -0,0 +1,51 @@
unit fDbError;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons;
type
{ TfrmDbError }
TfrmDbError = class(TForm)
btnVisitFAQ : TBitBtn;
btnOpenErrFile : TButton;
Button2 : TButton;
Label1 : TLabel;
procedure btnOpenErrFileClick(Sender : TObject);
procedure btnVisitFAQClick(Sender : TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
frmDbError : TfrmDbError;
implementation
uses dUtils, dData;
{ TfrmDbError }
procedure TfrmDbError.btnOpenErrFileClick(Sender : TObject);
begin
dmUtils.RunOnBackgroud('xdg-open ' + dmData.DataDir + 'mysql.err')
end;
procedure TfrmDbError.btnVisitFAQClick(Sender : TObject);
begin
dmUtils.RunOnBackgroud('xdg-open https://www.cqrlog.com/faq')
end;
initialization
{$I fDbError.lrs}
end.