diff options
| -rw-r--r-- | src/modinfodialog.ui | 67 | ||||
| -rw-r--r-- | src/modinfodialognexus.cpp | 11 | ||||
| -rw-r--r-- | src/modinfodialognexus.h | 1 | ||||
| -rw-r--r-- | src/texteditor.cpp | 18 | ||||
| -rw-r--r-- | src/texteditor.h | 1 |
5 files changed, 60 insertions, 38 deletions
diff --git a/src/modinfodialog.ui b/src/modinfodialog.ui index 01d70d73..4de65e95 100644 --- a/src/modinfodialog.ui +++ b/src/modinfodialog.ui @@ -887,7 +887,7 @@ text-align: left;</string> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,0,0,0,0,0,0,0,0,1">
<item>
<widget class="QToolButton" name="refresh">
<property name="sizePolicy">
@@ -996,20 +996,59 @@ p, li { white-space: pre-wrap; } </item>
<item>
<widget class="QLineEdit" name="version">
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
<property name="maxLength">
<number>32</number>
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</item>
<item>
+ <widget class="QWidget" name="widget_13" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>URL</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="url">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@@ -1054,20 +1093,6 @@ p, li { white-space: pre-wrap; } </layout>
</widget>
</item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_14">
- <item>
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>URL</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="url"/>
- </item>
- </layout>
- </item>
</layout>
</widget>
<widget class="QWidget" name="tabNotes">
diff --git a/src/modinfodialognexus.cpp b/src/modinfodialognexus.cpp index adf79060..e1fbe352 100644 --- a/src/modinfodialognexus.cpp +++ b/src/modinfodialognexus.cpp @@ -24,7 +24,6 @@ NexusTab::NexusTab( connect(ui->modID, &QLineEdit::editingFinished, [&]{ onModIDChanged(); }); connect(ui->version, &QLineEdit::editingFinished, [&]{ onVersionChanged(); }); connect(ui->openInBrowser, &QToolButton::clicked, [&]{ onOpenLink(); }); - connect(ui->url, &QLineEdit::editingFinished, [&]{ onUrlChanged(); }); connect(ui->endorse, &QToolButton::clicked, [&]{ onEndorse(); }); connect(ui->refresh, &QToolButton::clicked, [&]{ onRefreshBrowser(); }); @@ -242,16 +241,6 @@ void NexusTab::onVersionChanged() updateVersionColor(); } -void NexusTab::onUrlChanged() -{ - if (m_loading) { - return; - } - - mod()->setURL(ui->url->text()); - mod()->setLastNexusQuery(QDateTime::fromSecsSinceEpoch(0)); -} - void NexusTab::onOpenLink() { const int modID = mod()->getNexusID(); diff --git a/src/modinfodialognexus.h b/src/modinfodialognexus.h index 92330704..8528f0af 100644 --- a/src/modinfodialognexus.h +++ b/src/modinfodialognexus.h @@ -64,7 +64,6 @@ private: void onVersionChanged(); void onRefreshBrowser(); void onEndorse(); - void onUrlChanged(); }; #endif // MODINFODIALOGNEXUS_H diff --git a/src/texteditor.cpp b/src/texteditor.cpp index 9bbe3ddd..130cd76f 100644 --- a/src/texteditor.cpp +++ b/src/texteditor.cpp @@ -454,8 +454,9 @@ void TextEditorLineNumbers::updateArea(const QRect &rect, int dy) } -TextEditorToolbar::TextEditorToolbar(TextEditor& editor) - : m_editor(editor), m_save(nullptr), m_wordWrap(nullptr), m_explore(nullptr) +TextEditorToolbar::TextEditorToolbar(TextEditor& editor) : + m_editor(editor), m_save(nullptr), m_wordWrap(nullptr), m_explore(nullptr), + m_path(nullptr) { m_save = new QAction( QIcon(":/MO/gui/save"), QObject::tr("&Save"), &editor); @@ -467,10 +468,13 @@ TextEditorToolbar::TextEditorToolbar(TextEditor& editor) m_wordWrap = new QAction( QIcon(":/MO/gui/word-wrap"), QObject::tr("&Word wrap"), &editor); + m_wordWrap->setCheckable(true); + m_explore = new QAction( QObject::tr("&Open in Explorer"), &editor); - m_wordWrap->setCheckable(true); + m_path = new QLineEdit; + m_path->setReadOnly(true); QObject::connect(m_save, &QAction::triggered, [&]{ m_editor.save(); }); QObject::connect(m_wordWrap, &QAction::triggered, [&]{ m_editor.toggleWordWrap(); }); @@ -492,6 +496,8 @@ TextEditorToolbar::TextEditorToolbar(TextEditor& editor) b->setDefaultAction(m_explore); layout->addWidget(b); + layout->addWidget(m_path); + QObject::connect(&m_editor, &TextEditor::modified, [&](bool b){ onTextModified(b); }); QObject::connect(&m_editor, &TextEditor::wordWrapChanged, [&](bool b){ onWordWrap(b); }); QObject::connect(&m_editor, &TextEditor::loaded, [&](QString f){ onLoaded(f); }); @@ -507,12 +513,14 @@ void TextEditorToolbar::onWordWrap(bool b) m_wordWrap->setChecked(b); } -void TextEditorToolbar::onLoaded(const QString& s) +void TextEditorToolbar::onLoaded(const QString& path) { - const auto hasDoc = !s.isEmpty(); + const auto hasDoc = !path.isEmpty(); m_explore->setEnabled(hasDoc); m_wordWrap->setEnabled(hasDoc); + m_path->setEnabled(hasDoc); + m_path->setText(path); } void HTMLEditor::focusOutEvent(QFocusEvent* e) diff --git a/src/texteditor.h b/src/texteditor.h index 798222a3..dc53f1c4 100644 --- a/src/texteditor.h +++ b/src/texteditor.h @@ -17,6 +17,7 @@ private: QAction* m_save; QAction* m_wordWrap; QAction* m_explore; + QLineEdit* m_path; void onTextModified(bool b); void onWordWrap(bool b); |
