diff --git a/novelwriter/assets/icons/typicons_dark/icons.conf b/novelwriter/assets/icons/typicons_dark/icons.conf index 12354128..d90e35a7 100644 --- a/novelwriter/assets/icons/typicons_dark/icons.conf +++ b/novelwriter/assets/icons/typicons_dark/icons.conf @@ -17,6 +17,7 @@ licenseurl = https://creativecommons.org/licenses/by-sa/4.0/ [Map] add = typ_plus.svg +add_document = typ_document-add.svg alert_error = typ_delete-full.svg alert_info = typ_lightbulb-full.svg alert_question = typ_directions-full.svg diff --git a/novelwriter/assets/icons/typicons_dark/typ_document-add.svg b/novelwriter/assets/icons/typicons_dark/typ_document-add.svg new file mode 100644 index 00000000..68f6b53d --- /dev/null +++ b/novelwriter/assets/icons/typicons_dark/typ_document-add.svg @@ -0,0 +1,4 @@ + + + + diff --git a/novelwriter/assets/icons/typicons_light/icons.conf b/novelwriter/assets/icons/typicons_light/icons.conf index 584c5bab..757567a4 100644 --- a/novelwriter/assets/icons/typicons_light/icons.conf +++ b/novelwriter/assets/icons/typicons_light/icons.conf @@ -17,6 +17,7 @@ licenseurl = https://creativecommons.org/licenses/by-sa/4.0/ [Map] add = typ_plus.svg +add_document = typ_document-add.svg alert_error = typ_delete-full.svg alert_info = typ_lightbulb-full.svg alert_question = typ_directions-full.svg diff --git a/novelwriter/assets/icons/typicons_light/typ_document-add.svg b/novelwriter/assets/icons/typicons_light/typ_document-add.svg new file mode 100644 index 00000000..4e181685 --- /dev/null +++ b/novelwriter/assets/icons/typicons_light/typ_document-add.svg @@ -0,0 +1,4 @@ + + + + diff --git a/novelwriter/gui/theme.py b/novelwriter/gui/theme.py index 205ebe54..dc42eca5 100644 --- a/novelwriter/gui/theme.py +++ b/novelwriter/gui/theme.py @@ -466,10 +466,10 @@ class GuiIcons: "fmt_subscript", "fmt_superscript", "fmt_underline", # General Button Icons - "add", "backward", "bookmark", "browse", "checked", "close", "cross", "down", "edit", - "export", "forward", "maximise", "menu", "minimise", "noncheckable", "panel", "refresh", - "remove", "revert", "search_replace", "search", "settings", "star", "unchecked", "up", - "view", + "add", "add_document", "backward", "bookmark", "browse", "checked", "close", "cross", + "down", "edit", "export", "forward", "maximise", "menu", "minimise", "noncheckable", + "panel", "refresh", "remove", "revert", "search_replace", "search", "settings", "star", + "unchecked", "up", "view", # Switches "sticky-on", "sticky-off", diff --git a/novelwriter/tools/welcome.py b/novelwriter/tools/welcome.py index b7ed20d3..1048bf2c 100644 --- a/novelwriter/tools/welcome.py +++ b/novelwriter/tools/welcome.py @@ -263,23 +263,33 @@ class _NewProjectPage(QWidget): class _NewProjectForm(QWidget): + FILL_BLANK = 0 + FILL_SAMPLE = 1 + FILL_TEMPLATE = 2 + def __init__(self, parent: QWidget) -> None: super().__init__(parent=parent) self._basePath = CONFIG.lastPath() + self._fillMode = self.FILL_BLANK + self._tmplPath = None # Project Settings # ================ + posLast = QLineEdit.ActionPosition.TrailingPosition + # Project Name self.projName = QLineEdit() self.projName.setMaxLength(200) self.projName.setPlaceholderText(self.tr("Required")) self.projName.textChanged.connect(self._updateProjPath) + # Author(s) self.projAuthor = QLineEdit() self.projAuthor.setMaxLength(200) self.projAuthor.setPlaceholderText(self.tr("Optional")) + # Project Language self.projLang = QComboBox(self) for tag, language in CONFIG.listLanguages(CONFIG.LANG_PROJ): self.projLang.addItem(language, tag) @@ -290,23 +300,25 @@ class _NewProjectForm(QWidget): if langIdx != -1: self.projLang.setCurrentIndex(langIdx) - self.projPath = QLineEdit("", self) + # Project Path + self.projPath = QLineEdit(self) self.projPath.setReadOnly(True) self.projPath.setPlaceholderText(self.tr("Required")) + action = self.projPath.addAction(SHARED.theme.getIcon("browse"), posLast) + action.triggered.connect(self._doBrowse) - self.browsePath = QPushButton(self) - self.browsePath.setIcon(SHARED.theme.getIcon("browse")) - self.browsePath.clicked.connect(self._doBrowse) - - self.pathBox = QHBoxLayout() - self.pathBox.addWidget(self.projPath) - self.pathBox.addWidget(self.browsePath) + # Fill Project + self.projFill = QLineEdit(self) + self.projFill.setReadOnly(True) + action = self.projFill.addAction(SHARED.theme.getIcon("add_document"), posLast) + # Project Form self.projectForm = QFormLayout() self.projectForm.addRow(self.tr("Project Name"), self.projName) self.projectForm.addRow(self.tr("Author(s)"), self.projAuthor) self.projectForm.addRow(self.tr("Language"), self.projLang) - self.projectForm.addRow(self.tr("Project Path"), self.pathBox) + self.projectForm.addRow(self.tr("Project Path"), self.projPath) + self.projectForm.addRow(self.tr("Prefill Project"), self.projFill) # Chapters and Scenes # =================== @@ -364,6 +376,7 @@ class _NewProjectForm(QWidget): # ======== self.formBox = QVBoxLayout() + self.formBox.addWidget(QLabel("{0}".format(self.tr("Create New Project")))) self.formBox.addLayout(self.projectForm) self.formBox.addSpacing(16) self.formBox.addWidget(QLabel("{0}".format(self.tr("Chapters and Scenes")))) @@ -376,6 +389,7 @@ class _NewProjectForm(QWidget): self.setLayout(self.formBox) self._updateProjPath() + self._updateFillInfo() return @@ -412,4 +426,27 @@ class _NewProjectForm(QWidget): self.addNotes.setChecked(False) return + ## + # Internal Functions + ## + + def _updateFillInfo(self) -> None: + """Update the text of the project fill box.""" + if self._fillMode == self.FILL_BLANK: + self.projFill.setText(self.tr("Fresh Project")) + elif self._fillMode == self.FILL_SAMPLE: + self.projFill.setText(self.tr("Example Project")) + elif self._fillMode == self.FILL_TEMPLATE: + self.projFill.setText(self.tr("Template: {0}").format(str(self._tmplPath))) + + isBlank = self._fillMode == self.FILL_BLANK + self.numChapters.setEnabled(isBlank) + self.numScenes.setEnabled(isBlank) + self.addPlot.setEnabled(isBlank) + self.addChar.setEnabled(isBlank) + self.addWorld.setEnabled(isBlank) + self.addNotes.setEnabled(isBlank) + + return + # END Class _NewProjectForm