Add message on program start
This commit is contained in:
		
							parent
							
								
									8a65cddc6f
								
							
						
					
					
						commit
						ab23b6ba6c
					
				@ -28,6 +28,9 @@ Manager::Manager()
 | 
				
			|||||||
  Settings settings;
 | 
					  Settings settings;
 | 
				
			||||||
  settings.load();
 | 
					  settings.load();
 | 
				
			||||||
  updateSettings(settings);
 | 
					  updateSettings(settings);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (settings.showMessageOnStart)
 | 
				
			||||||
 | 
					    tray_->showInformation(QObject::tr("Screen translator started"));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Manager::~Manager() = default;
 | 
					Manager::~Manager() = default;
 | 
				
			||||||
 | 
				
			|||||||
@ -18,6 +18,7 @@ const QString qs_proxyPassword = "proxyPassword";
 | 
				
			|||||||
const QString qs_proxySavePassword = "proxySavePassword";
 | 
					const QString qs_proxySavePassword = "proxySavePassword";
 | 
				
			||||||
const QString qs_autoUpdateType = "autoUpdateType";
 | 
					const QString qs_autoUpdateType = "autoUpdateType";
 | 
				
			||||||
const QString qs_lastUpdateCheck = "lastUpdateCheck";
 | 
					const QString qs_lastUpdateCheck = "lastUpdateCheck";
 | 
				
			||||||
 | 
					const QString qs_showMessageOnStart = "showMessageOnStart";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const QString qs_recogntionGroup = "Recognition";
 | 
					const QString qs_recogntionGroup = "Recognition";
 | 
				
			||||||
const QString qs_tessDataPlace = "tessdata_dir";
 | 
					const QString qs_tessDataPlace = "tessdata_dir";
 | 
				
			||||||
@ -85,6 +86,8 @@ void Settings::save()
 | 
				
			|||||||
  settings.setValue(qs_repeatHotkey, showLastHotkey);
 | 
					  settings.setValue(qs_repeatHotkey, showLastHotkey);
 | 
				
			||||||
  settings.setValue(qs_clipboardHotkey, clipboardHotkey);
 | 
					  settings.setValue(qs_clipboardHotkey, clipboardHotkey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  settings.setValue(qs_showMessageOnStart, showMessageOnStart);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  settings.setValue(qs_resultShowType, int(resultShowType));
 | 
					  settings.setValue(qs_resultShowType, int(resultShowType));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  settings.setValue(qs_proxyType, int(proxyType));
 | 
					  settings.setValue(qs_proxyType, int(proxyType));
 | 
				
			||||||
@ -139,6 +142,9 @@ void Settings::load()
 | 
				
			|||||||
  clipboardHotkey =
 | 
					  clipboardHotkey =
 | 
				
			||||||
      settings.value(qs_clipboardHotkey, clipboardHotkey).toString();
 | 
					      settings.value(qs_clipboardHotkey, clipboardHotkey).toString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  showMessageOnStart =
 | 
				
			||||||
 | 
					      settings.value(qs_showMessageOnStart, showMessageOnStart).toBool();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  resultShowType = ResultMode(
 | 
					  resultShowType = ResultMode(
 | 
				
			||||||
      std::clamp(settings.value(qs_resultShowType, int(resultShowType)).toInt(),
 | 
					      std::clamp(settings.value(qs_resultShowType, int(resultShowType)).toInt(),
 | 
				
			||||||
                 int(ResultMode::Widget), int(ResultMode::Tooltip)));
 | 
					                 int(ResultMode::Widget), int(ResultMode::Tooltip)));
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,8 @@ public:
 | 
				
			|||||||
  QString showLastHotkey{"Ctrl+Alt+X"};
 | 
					  QString showLastHotkey{"Ctrl+Alt+X"};
 | 
				
			||||||
  QString clipboardHotkey{"Ctrl+Alt+C"};
 | 
					  QString clipboardHotkey{"Ctrl+Alt+C"};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  bool showMessageOnStart{true};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ProxyType proxyType{ProxyType::System};
 | 
					  ProxyType proxyType{ProxyType::System};
 | 
				
			||||||
  QString proxyHostName;
 | 
					  QString proxyHostName;
 | 
				
			||||||
  int proxyPort{8080};
 | 
					  int proxyPort{8080};
 | 
				
			||||||
 | 
				
			|||||||
@ -75,6 +75,8 @@ Settings SettingsEditor::settings() const
 | 
				
			|||||||
  settings.showLastHotkey = ui->repeatEdit->keySequence().toString();
 | 
					  settings.showLastHotkey = ui->repeatEdit->keySequence().toString();
 | 
				
			||||||
  settings.clipboardHotkey = ui->clipboardEdit->keySequence().toString();
 | 
					  settings.clipboardHotkey = ui->clipboardEdit->keySequence().toString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  settings.showMessageOnStart = ui->showOnStart->isChecked();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  settings.proxyType = ProxyType(ui->proxyTypeCombo->currentIndex());
 | 
					  settings.proxyType = ProxyType(ui->proxyTypeCombo->currentIndex());
 | 
				
			||||||
  settings.proxyHostName = ui->proxyHostEdit->text();
 | 
					  settings.proxyHostName = ui->proxyHostEdit->text();
 | 
				
			||||||
  settings.proxyPort = ui->proxyPortSpin->value();
 | 
					  settings.proxyPort = ui->proxyPortSpin->value();
 | 
				
			||||||
@ -117,6 +119,8 @@ void SettingsEditor::setSettings(const Settings &settings)
 | 
				
			|||||||
  ui->repeatEdit->setKeySequence(settings.showLastHotkey);
 | 
					  ui->repeatEdit->setKeySequence(settings.showLastHotkey);
 | 
				
			||||||
  ui->clipboardEdit->setKeySequence(settings.clipboardHotkey);
 | 
					  ui->clipboardEdit->setKeySequence(settings.clipboardHotkey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ui->showOnStart->setChecked(settings.showMessageOnStart);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui->proxyTypeCombo->setCurrentIndex(int(settings.proxyType));
 | 
					  ui->proxyTypeCombo->setCurrentIndex(int(settings.proxyType));
 | 
				
			||||||
  ui->proxyHostEdit->setText(settings.proxyHostName);
 | 
					  ui->proxyHostEdit->setText(settings.proxyHostName);
 | 
				
			||||||
  ui->proxyPortSpin->setValue(settings.proxyPort);
 | 
					  ui->proxyPortSpin->setValue(settings.proxyPort);
 | 
				
			||||||
 | 
				
			|||||||
@ -181,6 +181,13 @@
 | 
				
			|||||||
         </layout>
 | 
					         </layout>
 | 
				
			||||||
        </widget>
 | 
					        </widget>
 | 
				
			||||||
       </item>
 | 
					       </item>
 | 
				
			||||||
 | 
					       <item>
 | 
				
			||||||
 | 
					        <widget class="QCheckBox" name="showOnStart">
 | 
				
			||||||
 | 
					         <property name="text">
 | 
				
			||||||
 | 
					          <string>Show message on program start</string>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					        </widget>
 | 
				
			||||||
 | 
					       </item>
 | 
				
			||||||
       <item>
 | 
					       <item>
 | 
				
			||||||
        <spacer name="verticalSpacer_4">
 | 
					        <spacer name="verticalSpacer_4">
 | 
				
			||||||
         <property name="orientation">
 | 
					         <property name="orientation">
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user