diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b9672c0a81..c7947d6082b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,6 +156,7 @@ endif() add_subdirectory(src) add_subdirectory(share) +add_subdirectory(dist) if (WITH_TESTS) add_subdirectory(tests) diff --git a/dist/CMakeLists.txt b/dist/CMakeLists.txt new file mode 100644 index 00000000000..14c8d31a1dd --- /dev/null +++ b/dist/CMakeLists.txt @@ -0,0 +1,11 @@ +# copy resource directories during build +qtc_copy_to_builddir(copy_changelog_to_builddir + DIRECTORIES changelog + DESTINATION "${IDE_DATA_PATH}" + CREATE_SUBDIRS +) + +install( + DIRECTORY changelog + DESTINATION ${IDE_DATA_PATH} +) diff --git a/dist/changes-1.1.0 b/dist/changelog/changes-1.1.0 similarity index 100% rename from dist/changes-1.1.0 rename to dist/changelog/changes-1.1.0 diff --git a/dist/changes-1.1.1 b/dist/changelog/changes-1.1.1 similarity index 100% rename from dist/changes-1.1.1 rename to dist/changelog/changes-1.1.1 diff --git a/dist/changes-1.2.0 b/dist/changelog/changes-1.2.0 similarity index 100% rename from dist/changes-1.2.0 rename to dist/changelog/changes-1.2.0 diff --git a/dist/changes-1.2.1 b/dist/changelog/changes-1.2.1 similarity index 100% rename from dist/changes-1.2.1 rename to dist/changelog/changes-1.2.1 diff --git a/dist/changes-1.3.0 b/dist/changelog/changes-1.3.0 similarity index 100% rename from dist/changes-1.3.0 rename to dist/changelog/changes-1.3.0 diff --git a/dist/changes-1.3.1 b/dist/changelog/changes-1.3.1 similarity index 100% rename from dist/changes-1.3.1 rename to dist/changelog/changes-1.3.1 diff --git a/dist/changes-2.0.0 b/dist/changelog/changes-2.0.0 similarity index 100% rename from dist/changes-2.0.0 rename to dist/changelog/changes-2.0.0 diff --git a/dist/changes-2.0.1 b/dist/changelog/changes-2.0.1 similarity index 100% rename from dist/changes-2.0.1 rename to dist/changelog/changes-2.0.1 diff --git a/dist/changes-2.1.0 b/dist/changelog/changes-2.1.0 similarity index 100% rename from dist/changes-2.1.0 rename to dist/changelog/changes-2.1.0 diff --git a/dist/changes-2.2.0 b/dist/changelog/changes-2.2.0 similarity index 100% rename from dist/changes-2.2.0 rename to dist/changelog/changes-2.2.0 diff --git a/dist/changes-2.3.0 b/dist/changelog/changes-2.3.0 similarity index 100% rename from dist/changes-2.3.0 rename to dist/changelog/changes-2.3.0 diff --git a/dist/changes-2.3.1 b/dist/changelog/changes-2.3.1 similarity index 100% rename from dist/changes-2.3.1 rename to dist/changelog/changes-2.3.1 diff --git a/dist/changes-2.4.0 b/dist/changelog/changes-2.4.0 similarity index 100% rename from dist/changes-2.4.0 rename to dist/changelog/changes-2.4.0 diff --git a/dist/changes-2.4.1 b/dist/changelog/changes-2.4.1 similarity index 100% rename from dist/changes-2.4.1 rename to dist/changelog/changes-2.4.1 diff --git a/dist/changes-2.5.0 b/dist/changelog/changes-2.5.0 similarity index 100% rename from dist/changes-2.5.0 rename to dist/changelog/changes-2.5.0 diff --git a/dist/changes-2.5.1 b/dist/changelog/changes-2.5.1 similarity index 100% rename from dist/changes-2.5.1 rename to dist/changelog/changes-2.5.1 diff --git a/dist/changes-2.5.2 b/dist/changelog/changes-2.5.2 similarity index 100% rename from dist/changes-2.5.2 rename to dist/changelog/changes-2.5.2 diff --git a/dist/changes-2.6.0 b/dist/changelog/changes-2.6.0 similarity index 100% rename from dist/changes-2.6.0 rename to dist/changelog/changes-2.6.0 diff --git a/dist/changes-2.6.1 b/dist/changelog/changes-2.6.1 similarity index 100% rename from dist/changes-2.6.1 rename to dist/changelog/changes-2.6.1 diff --git a/dist/changes-2.6.2 b/dist/changelog/changes-2.6.2 similarity index 100% rename from dist/changes-2.6.2 rename to dist/changelog/changes-2.6.2 diff --git a/dist/changes-2.7.0 b/dist/changelog/changes-2.7.0 similarity index 100% rename from dist/changes-2.7.0 rename to dist/changelog/changes-2.7.0 diff --git a/dist/changes-2.8.0 b/dist/changelog/changes-2.8.0 similarity index 100% rename from dist/changes-2.8.0 rename to dist/changelog/changes-2.8.0 diff --git a/dist/changes-2.8.1 b/dist/changelog/changes-2.8.1 similarity index 100% rename from dist/changes-2.8.1 rename to dist/changelog/changes-2.8.1 diff --git a/dist/changes-3.0.0 b/dist/changelog/changes-3.0.0 similarity index 100% rename from dist/changes-3.0.0 rename to dist/changelog/changes-3.0.0 diff --git a/dist/changes-3.0.1 b/dist/changelog/changes-3.0.1 similarity index 100% rename from dist/changes-3.0.1 rename to dist/changelog/changes-3.0.1 diff --git a/dist/changes-3.1.0 b/dist/changelog/changes-3.1.0 similarity index 100% rename from dist/changes-3.1.0 rename to dist/changelog/changes-3.1.0 diff --git a/dist/changes-3.1.1 b/dist/changelog/changes-3.1.1 similarity index 100% rename from dist/changes-3.1.1 rename to dist/changelog/changes-3.1.1 diff --git a/dist/changes-3.1.2 b/dist/changelog/changes-3.1.2 similarity index 100% rename from dist/changes-3.1.2 rename to dist/changelog/changes-3.1.2 diff --git a/dist/changes-3.2.0 b/dist/changelog/changes-3.2.0 similarity index 100% rename from dist/changes-3.2.0 rename to dist/changelog/changes-3.2.0 diff --git a/dist/changes-3.2.1 b/dist/changelog/changes-3.2.1 similarity index 100% rename from dist/changes-3.2.1 rename to dist/changelog/changes-3.2.1 diff --git a/dist/changes-3.2.2 b/dist/changelog/changes-3.2.2 similarity index 100% rename from dist/changes-3.2.2 rename to dist/changelog/changes-3.2.2 diff --git a/dist/changes-3.3.0 b/dist/changelog/changes-3.3.0 similarity index 100% rename from dist/changes-3.3.0 rename to dist/changelog/changes-3.3.0 diff --git a/dist/changes-3.3.1 b/dist/changelog/changes-3.3.1 similarity index 100% rename from dist/changes-3.3.1 rename to dist/changelog/changes-3.3.1 diff --git a/dist/changes-3.3.2 b/dist/changelog/changes-3.3.2 similarity index 100% rename from dist/changes-3.3.2 rename to dist/changelog/changes-3.3.2 diff --git a/dist/changes-3.4.0 b/dist/changelog/changes-3.4.0 similarity index 100% rename from dist/changes-3.4.0 rename to dist/changelog/changes-3.4.0 diff --git a/dist/changes-3.4.1.md b/dist/changelog/changes-3.4.1.md similarity index 100% rename from dist/changes-3.4.1.md rename to dist/changelog/changes-3.4.1.md diff --git a/dist/changes-3.5.0.md b/dist/changelog/changes-3.5.0.md similarity index 100% rename from dist/changes-3.5.0.md rename to dist/changelog/changes-3.5.0.md diff --git a/dist/changes-3.5.1.md b/dist/changelog/changes-3.5.1.md similarity index 100% rename from dist/changes-3.5.1.md rename to dist/changelog/changes-3.5.1.md diff --git a/dist/changes-3.6.0.md b/dist/changelog/changes-3.6.0.md similarity index 100% rename from dist/changes-3.6.0.md rename to dist/changelog/changes-3.6.0.md diff --git a/dist/changes-3.6.1.md b/dist/changelog/changes-3.6.1.md similarity index 100% rename from dist/changes-3.6.1.md rename to dist/changelog/changes-3.6.1.md diff --git a/dist/changes-4.0.0.md b/dist/changelog/changes-4.0.0.md similarity index 100% rename from dist/changes-4.0.0.md rename to dist/changelog/changes-4.0.0.md diff --git a/dist/changes-4.0.1.md b/dist/changelog/changes-4.0.1.md similarity index 100% rename from dist/changes-4.0.1.md rename to dist/changelog/changes-4.0.1.md diff --git a/dist/changes-4.0.2.md b/dist/changelog/changes-4.0.2.md similarity index 100% rename from dist/changes-4.0.2.md rename to dist/changelog/changes-4.0.2.md diff --git a/dist/changes-4.0.3.md b/dist/changelog/changes-4.0.3.md similarity index 100% rename from dist/changes-4.0.3.md rename to dist/changelog/changes-4.0.3.md diff --git a/dist/changes-4.1.0.md b/dist/changelog/changes-4.1.0.md similarity index 100% rename from dist/changes-4.1.0.md rename to dist/changelog/changes-4.1.0.md diff --git a/dist/changes-4.10.0.md b/dist/changelog/changes-4.10.0.md similarity index 100% rename from dist/changes-4.10.0.md rename to dist/changelog/changes-4.10.0.md diff --git a/dist/changes-4.10.1.md b/dist/changelog/changes-4.10.1.md similarity index 100% rename from dist/changes-4.10.1.md rename to dist/changelog/changes-4.10.1.md diff --git a/dist/changes-4.11.0.md b/dist/changelog/changes-4.11.0.md similarity index 100% rename from dist/changes-4.11.0.md rename to dist/changelog/changes-4.11.0.md diff --git a/dist/changes-4.11.1.md b/dist/changelog/changes-4.11.1.md similarity index 100% rename from dist/changes-4.11.1.md rename to dist/changelog/changes-4.11.1.md diff --git a/dist/changes-4.11.2.md b/dist/changelog/changes-4.11.2.md similarity index 100% rename from dist/changes-4.11.2.md rename to dist/changelog/changes-4.11.2.md diff --git a/dist/changes-4.12.0.md b/dist/changelog/changes-4.12.0.md similarity index 100% rename from dist/changes-4.12.0.md rename to dist/changelog/changes-4.12.0.md diff --git a/dist/changes-4.12.1.md b/dist/changelog/changes-4.12.1.md similarity index 100% rename from dist/changes-4.12.1.md rename to dist/changelog/changes-4.12.1.md diff --git a/dist/changes-4.12.2.md b/dist/changelog/changes-4.12.2.md similarity index 100% rename from dist/changes-4.12.2.md rename to dist/changelog/changes-4.12.2.md diff --git a/dist/changes-4.12.3.md b/dist/changelog/changes-4.12.3.md similarity index 100% rename from dist/changes-4.12.3.md rename to dist/changelog/changes-4.12.3.md diff --git a/dist/changes-4.12.4.md b/dist/changelog/changes-4.12.4.md similarity index 100% rename from dist/changes-4.12.4.md rename to dist/changelog/changes-4.12.4.md diff --git a/dist/changes-4.13.0.md b/dist/changelog/changes-4.13.0.md similarity index 100% rename from dist/changes-4.13.0.md rename to dist/changelog/changes-4.13.0.md diff --git a/dist/changes-4.13.1.md b/dist/changelog/changes-4.13.1.md similarity index 100% rename from dist/changes-4.13.1.md rename to dist/changelog/changes-4.13.1.md diff --git a/dist/changes-4.13.2.md b/dist/changelog/changes-4.13.2.md similarity index 100% rename from dist/changes-4.13.2.md rename to dist/changelog/changes-4.13.2.md diff --git a/dist/changes-4.13.3.md b/dist/changelog/changes-4.13.3.md similarity index 100% rename from dist/changes-4.13.3.md rename to dist/changelog/changes-4.13.3.md diff --git a/dist/changes-4.14.0.md b/dist/changelog/changes-4.14.0.md similarity index 100% rename from dist/changes-4.14.0.md rename to dist/changelog/changes-4.14.0.md diff --git a/dist/changes-4.14.1.md b/dist/changelog/changes-4.14.1.md similarity index 100% rename from dist/changes-4.14.1.md rename to dist/changelog/changes-4.14.1.md diff --git a/dist/changes-4.14.2.md b/dist/changelog/changes-4.14.2.md similarity index 100% rename from dist/changes-4.14.2.md rename to dist/changelog/changes-4.14.2.md diff --git a/dist/changes-4.15.0.md b/dist/changelog/changes-4.15.0.md similarity index 100% rename from dist/changes-4.15.0.md rename to dist/changelog/changes-4.15.0.md diff --git a/dist/changes-4.15.1.md b/dist/changelog/changes-4.15.1.md similarity index 100% rename from dist/changes-4.15.1.md rename to dist/changelog/changes-4.15.1.md diff --git a/dist/changes-4.15.2.md b/dist/changelog/changes-4.15.2.md similarity index 100% rename from dist/changes-4.15.2.md rename to dist/changelog/changes-4.15.2.md diff --git a/dist/changes-4.2.0.md b/dist/changelog/changes-4.2.0.md similarity index 100% rename from dist/changes-4.2.0.md rename to dist/changelog/changes-4.2.0.md diff --git a/dist/changes-4.2.1.md b/dist/changelog/changes-4.2.1.md similarity index 100% rename from dist/changes-4.2.1.md rename to dist/changelog/changes-4.2.1.md diff --git a/dist/changes-4.2.2.md b/dist/changelog/changes-4.2.2.md similarity index 100% rename from dist/changes-4.2.2.md rename to dist/changelog/changes-4.2.2.md diff --git a/dist/changes-4.3.0.md b/dist/changelog/changes-4.3.0.md similarity index 100% rename from dist/changes-4.3.0.md rename to dist/changelog/changes-4.3.0.md diff --git a/dist/changes-4.3.1.md b/dist/changelog/changes-4.3.1.md similarity index 100% rename from dist/changes-4.3.1.md rename to dist/changelog/changes-4.3.1.md diff --git a/dist/changes-4.4.0.md b/dist/changelog/changes-4.4.0.md similarity index 100% rename from dist/changes-4.4.0.md rename to dist/changelog/changes-4.4.0.md diff --git a/dist/changes-4.4.1.md b/dist/changelog/changes-4.4.1.md similarity index 100% rename from dist/changes-4.4.1.md rename to dist/changelog/changes-4.4.1.md diff --git a/dist/changes-4.5.0.md b/dist/changelog/changes-4.5.0.md similarity index 100% rename from dist/changes-4.5.0.md rename to dist/changelog/changes-4.5.0.md diff --git a/dist/changes-4.5.1.md b/dist/changelog/changes-4.5.1.md similarity index 100% rename from dist/changes-4.5.1.md rename to dist/changelog/changes-4.5.1.md diff --git a/dist/changes-4.5.2.md b/dist/changelog/changes-4.5.2.md similarity index 100% rename from dist/changes-4.5.2.md rename to dist/changelog/changes-4.5.2.md diff --git a/dist/changes-4.6.0.md b/dist/changelog/changes-4.6.0.md similarity index 100% rename from dist/changes-4.6.0.md rename to dist/changelog/changes-4.6.0.md diff --git a/dist/changes-4.6.1.md b/dist/changelog/changes-4.6.1.md similarity index 100% rename from dist/changes-4.6.1.md rename to dist/changelog/changes-4.6.1.md diff --git a/dist/changes-4.6.2.md b/dist/changelog/changes-4.6.2.md similarity index 100% rename from dist/changes-4.6.2.md rename to dist/changelog/changes-4.6.2.md diff --git a/dist/changes-4.7.0.md b/dist/changelog/changes-4.7.0.md similarity index 100% rename from dist/changes-4.7.0.md rename to dist/changelog/changes-4.7.0.md diff --git a/dist/changes-4.7.1.md b/dist/changelog/changes-4.7.1.md similarity index 100% rename from dist/changes-4.7.1.md rename to dist/changelog/changes-4.7.1.md diff --git a/dist/changes-4.7.2.md b/dist/changelog/changes-4.7.2.md similarity index 100% rename from dist/changes-4.7.2.md rename to dist/changelog/changes-4.7.2.md diff --git a/dist/changes-4.8.0.md b/dist/changelog/changes-4.8.0.md similarity index 100% rename from dist/changes-4.8.0.md rename to dist/changelog/changes-4.8.0.md diff --git a/dist/changes-4.8.1.md b/dist/changelog/changes-4.8.1.md similarity index 100% rename from dist/changes-4.8.1.md rename to dist/changelog/changes-4.8.1.md diff --git a/dist/changes-4.8.2.md b/dist/changelog/changes-4.8.2.md similarity index 100% rename from dist/changes-4.8.2.md rename to dist/changelog/changes-4.8.2.md diff --git a/dist/changes-4.9.0.md b/dist/changelog/changes-4.9.0.md similarity index 100% rename from dist/changes-4.9.0.md rename to dist/changelog/changes-4.9.0.md diff --git a/dist/changes-4.9.1.md b/dist/changelog/changes-4.9.1.md similarity index 100% rename from dist/changes-4.9.1.md rename to dist/changelog/changes-4.9.1.md diff --git a/dist/changes-4.9.2.md b/dist/changelog/changes-4.9.2.md similarity index 100% rename from dist/changes-4.9.2.md rename to dist/changelog/changes-4.9.2.md diff --git a/dist/changes-5.0.0.md b/dist/changelog/changes-5.0.0.md similarity index 100% rename from dist/changes-5.0.0.md rename to dist/changelog/changes-5.0.0.md diff --git a/dist/changes-5.0.1.md b/dist/changelog/changes-5.0.1.md similarity index 100% rename from dist/changes-5.0.1.md rename to dist/changelog/changes-5.0.1.md diff --git a/dist/changes-5.0.2.md b/dist/changelog/changes-5.0.2.md similarity index 100% rename from dist/changes-5.0.2.md rename to dist/changelog/changes-5.0.2.md diff --git a/dist/changes-5.0.3.md b/dist/changelog/changes-5.0.3.md similarity index 100% rename from dist/changes-5.0.3.md rename to dist/changelog/changes-5.0.3.md diff --git a/dist/changes-6.0.0.md b/dist/changelog/changes-6.0.0.md similarity index 100% rename from dist/changes-6.0.0.md rename to dist/changelog/changes-6.0.0.md diff --git a/dist/changes-6.0.1.md b/dist/changelog/changes-6.0.1.md similarity index 100% rename from dist/changes-6.0.1.md rename to dist/changelog/changes-6.0.1.md diff --git a/dist/changes-6.0.2.md b/dist/changelog/changes-6.0.2.md similarity index 100% rename from dist/changes-6.0.2.md rename to dist/changelog/changes-6.0.2.md diff --git a/dist/changes-7.0.0.md b/dist/changelog/changes-7.0.0.md similarity index 100% rename from dist/changes-7.0.0.md rename to dist/changelog/changes-7.0.0.md diff --git a/dist/changes-7.0.1.md b/dist/changelog/changes-7.0.1.md similarity index 100% rename from dist/changes-7.0.1.md rename to dist/changelog/changes-7.0.1.md diff --git a/dist/changes-7.0.2.md b/dist/changelog/changes-7.0.2.md similarity index 100% rename from dist/changes-7.0.2.md rename to dist/changelog/changes-7.0.2.md diff --git a/dist/changes-8.0.0.md b/dist/changelog/changes-8.0.0.md similarity index 100% rename from dist/changes-8.0.0.md rename to dist/changelog/changes-8.0.0.md diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index 77ada82f061..fd5e21963a7 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -136,6 +136,7 @@ const char GO_FORWARD[] = "QtCreator.GoForward"; const char GOTOLASTEDIT[] = "QtCreator.GotoLastEdit"; const char ABOUT_QTCREATOR[] = "QtCreator.AboutQtCreator"; const char ABOUT_PLUGINS[] = "QtCreator.AboutPlugins"; +const char CHANGE_LOG[] = "QtCreator.ChangeLog"; const char S_RETURNTOEDITOR[] = "QtCreator.ReturnToEditor"; const char SHOWINGRAPHICALSHELL[] = "QtCreator.ShowInGraphicalShell"; const char SHOWINFILESYSTEMVIEW[] = "QtCreator.ShowInFileSystemView"; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 4bd44b5dddc..880719420b6 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -61,6 +61,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -83,7 +86,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -93,8 +98,10 @@ #include #include #include +#include #include #include +#include #include using namespace ExtensionSystem; @@ -830,11 +837,19 @@ void MainWindow::registerDefaultActions() tmpaction->setEnabled(true); connect(tmpaction, &QAction::triggered, this, &MainWindow::aboutPlugins); // About Qt Action -// tmpaction = new QAction(tr("About &Qt..."), this); -// cmd = ActionManager::registerAction(tmpaction, Constants:: ABOUT_QT); -// mhelp->addAction(cmd, Constants::G_HELP_ABOUT); -// tmpaction->setEnabled(true); -// connect(tmpaction, &QAction::triggered, qApp, &QApplication::aboutQt); + // tmpaction = new QAction(tr("About &Qt..."), this); + // cmd = ActionManager::registerAction(tmpaction, Constants:: ABOUT_QT); + // mhelp->addAction(cmd, Constants::G_HELP_ABOUT); + // tmpaction->setEnabled(true); + // connect(tmpaction, &QAction::triggered, qApp, &QApplication::aboutQt); + + // Change Log Action + tmpaction = new QAction(tr("Change Log..."), this); + tmpaction->setMenuRole(QAction::ApplicationSpecificRole); + cmd = ActionManager::registerAction(tmpaction, Constants::CHANGE_LOG); + mhelp->addAction(cmd, Constants::G_HELP_ABOUT); + tmpaction->setEnabled(true); + connect(tmpaction, &QAction::triggered, this, &MainWindow::changeLog); // Contact tmpaction = new QAction(tr("Contact..."), this); @@ -1314,6 +1329,110 @@ void MainWindow::aboutPlugins() dialog.exec(); } +class LogDialog : public QDialog +{ +public: + LogDialog(QWidget *parent) + : QDialog(parent) + {} + bool event(QEvent *event) override + { + if (event->type() == QEvent::ShortcutOverride) { + auto ke = static_cast(event); + if (ke->key() == Qt::Key_Escape && !ke->modifiers()) { + ke->accept(); + return true; + } + } + return QDialog::event(event); + } +}; + +void MainWindow::changeLog() +{ + static QPointer dialog; + if (dialog) { + ICore::raiseWindow(dialog); + return; + } + const QList files = ICore::resourcePath("changelog") + .dirEntries({{"changes-*"}, QDir::Files}); + static const QRegularExpression versionRegex("\\d+[.]\\d+[.]\\d+"); + using VersionFilePair = std::pair; + QList versionedFiles = Utils::transform(files, [](const FilePath &fp) { + const QRegularExpressionMatch match = versionRegex.match(fp.fileName()); + const QVersionNumber version = match.hasMatch() + ? QVersionNumber::fromString(match.captured()) + : QVersionNumber(); + return std::make_pair(version, fp); + }); + Utils::sort(versionedFiles, [](const VersionFilePair &a, const VersionFilePair &b) { + return a.first > b.first; + }); + + auto versionCombo = new QComboBox; + for (const VersionFilePair &f : versionedFiles) + versionCombo->addItem(f.first.toString()); + dialog = new LogDialog(ICore::dialogParent()); + auto versionLayout = new QHBoxLayout; + versionLayout->addWidget(new QLabel(tr("Version:"))); + versionLayout->addWidget(versionCombo); + versionLayout->addStretch(1); + auto showInExplorer = new QPushButton(FileUtils::msgGraphicalShellAction()); + versionLayout->addWidget(showInExplorer); + auto textEdit = new QTextEdit; + textEdit->setReadOnly(true); + + auto aggregate = new Aggregation::Aggregate; + aggregate->add(textEdit); + aggregate->add(new Core::BaseTextFind(textEdit)); + + auto textEditWidget = new QFrame; + textEditWidget->setFrameStyle(QFrame::NoFrame); + auto findToolBar = new FindToolBarPlaceHolder(dialog); + findToolBar->setLightColored(true); + auto textEditLayout = new QVBoxLayout; + textEditLayout->setContentsMargins(0, 0, 0, 0); + textEditLayout->setSpacing(0); + textEditLayout->addWidget(textEdit); + textEditLayout->addWidget(findToolBar); + textEditWidget->setLayout(textEditLayout); + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); + auto dialogLayout = new QVBoxLayout; + dialogLayout->addLayout(versionLayout); + dialogLayout->addWidget(textEditWidget); + dialogLayout->addWidget(buttonBox); + dialog->setLayout(dialogLayout); + dialog->resize(700, 600); + dialog->setWindowTitle(tr("Change Log")); + dialog->setAttribute(Qt::WA_DeleteOnClose); + ICore::registerWindow(dialog, Context("CorePlugin.VersionDialog")); + + connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::close); + QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close); + if (QTC_GUARD(closeButton)) + closeButton->setDefault(true); // grab from "Open in Explorer" button + + const auto showLog = [textEdit, versionedFiles](int index) { + if (index < 0 || index >= versionedFiles.size()) + return; + const FilePath file = versionedFiles.at(index).second; + textEdit->setText(QString::fromUtf8(file.fileContents())); + }; + connect(versionCombo, QOverload::of(&QComboBox::currentIndexChanged), textEdit, showLog); + showLog(versionCombo->currentIndex()); + + connect(showInExplorer, &QPushButton::clicked, [versionCombo, versionedFiles] { + const int index = versionCombo->currentIndex(); + if (index >= 0 && index < versionedFiles.size()) + FileUtils::showInGraphicalShell(ICore::dialogParent(), versionedFiles.at(index).second); + else + FileUtils::showInGraphicalShell(ICore::dialogParent(), ICore::resourcePath("changelog")); + }); + + dialog->show(); +} + void MainWindow::contact() { QMessageBox dlg(QMessageBox::Information, tr("Contact"), diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index b365c0c1ee0..9765373ab37 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -129,6 +129,7 @@ private: static void setFocusToEditor(); void aboutQtCreator(); void aboutPlugins(); + void changeLog(); void contact(); void updateFocusWidget(QWidget *old, QWidget *now); NavigationWidget *navigationWidget(Side side) const;