rename setting keys
This commit is contained in:
@@ -6,9 +6,8 @@ from ..__version__ import __title__
|
||||
|
||||
DEFAULT_SETTINGS = {
|
||||
"message/check_missed/notify": True,
|
||||
"message/last_id": 0,
|
||||
"logging/level": "Disabled",
|
||||
"settings/export_path": os.path.join(
|
||||
"export/path": os.path.join(
|
||||
Path.home(), f"{__title__.replace(' ', '-').lower()}-settings.bytes"
|
||||
),
|
||||
"shortcuts/quit": "Ctrl+Q",
|
||||
|
||||
@@ -23,8 +23,8 @@ class Settings(QtCore.QSettings):
|
||||
for key in self.allKeys()
|
||||
if not ( # skip settings that might not translate well between platforms
|
||||
isinstance(self.value(key), QtCore.QByteArray)
|
||||
or key == "settings/export_path"
|
||||
or key == "message/last_id"
|
||||
or key == "export/path"
|
||||
or key == "message/last"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -127,8 +127,8 @@ class MainApplication(QtWidgets.QApplication):
|
||||
)
|
||||
|
||||
def update_last_id(self, i: int):
|
||||
if i > settings.value("message/last_id", type=int):
|
||||
settings.setValue("message/last_id", i)
|
||||
if i > settings.value("message/last", type=int):
|
||||
settings.setValue("message/last", i)
|
||||
|
||||
def listener_opened_callback(self):
|
||||
self.main_window.set_active()
|
||||
@@ -140,7 +140,7 @@ class MainApplication(QtWidgets.QApplication):
|
||||
return
|
||||
|
||||
def get_missed_messages_callback(page: gotify.GotifyPagedMessagesModel):
|
||||
last_id = settings.value("message/last_id", type=int)
|
||||
last_id = settings.value("message/last", type=int)
|
||||
ids = []
|
||||
|
||||
page.messages.reverse()
|
||||
|
||||
@@ -73,10 +73,7 @@ class ServerInfoDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
def import_callback(self):
|
||||
fname = QtWidgets.QFileDialog.getOpenFileName(
|
||||
self,
|
||||
"Import Settings",
|
||||
settings.value("settings/export_path", type=str),
|
||||
"*",
|
||||
self, "Import Settings", settings.value("export/path", type=str), "*",
|
||||
)[0]
|
||||
if fname and os.path.exists(fname):
|
||||
self.import_settings_task = ImportSettingsTask(fname)
|
||||
|
||||
@@ -99,15 +99,12 @@ class SettingsDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
def export_callback(self):
|
||||
fname = QtWidgets.QFileDialog.getSaveFileName(
|
||||
self,
|
||||
"Export Settings",
|
||||
settings.value("settings/export_path", type=str),
|
||||
"*",
|
||||
self, "Export Settings", settings.value("export/path", type=str), "*",
|
||||
)[0]
|
||||
if fname and os.path.exists(os.path.dirname(fname)):
|
||||
self.export_settings_task = ExportSettingsTask(fname)
|
||||
self.export_settings_task.start()
|
||||
settings.setValue("settings/export_path", fname)
|
||||
settings.setValue("export/path", fname)
|
||||
|
||||
def import_success_callback(self):
|
||||
response = QtWidgets.QMessageBox.information(
|
||||
@@ -118,10 +115,7 @@ class SettingsDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
def import_callback(self):
|
||||
fname = QtWidgets.QFileDialog.getOpenFileName(
|
||||
self,
|
||||
"Import Settings",
|
||||
settings.value("settings/export_path", type=str),
|
||||
"*",
|
||||
self, "Import Settings", settings.value("export/path", type=str), "*",
|
||||
)[0]
|
||||
if fname and os.path.exists(fname):
|
||||
self.import_settings_task = ImportSettingsTask(fname)
|
||||
|
||||
Reference in New Issue
Block a user