Skip to content

Commit

Permalink
All: adapt to new API from qmdilib/PluginManager
Browse files Browse the repository at this point in the history
The main library moved to using standard QDockWidgets for side panels.
Adapt code for this.
  • Loading branch information
diegoiast committed Jan 1, 2025
1 parent 79819e2 commit ab41f50
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ int main(int argc, char *argv[]) {
pluginManager.addPlugin(new ImageViewrPlugin);
pluginManager.addPlugin(new HexViewrPlugin);
pluginManager.updateGUI();
pluginManager.hideUnusedPanels();
pluginManager.hidePanels(Qt::BottomDockWidgetArea);

pluginManager.restoreSettings();
pluginManager.show();

Expand Down
24 changes: 15 additions & 9 deletions src/plugins/ProjectManager/ProjectManagerPlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ void ProjectManagerPlugin::on_client_merged(qmdiHost *host) {

connect(gui->projectComboBox, &QComboBox::currentIndexChanged, this,
&ProjectManagerPlugin::newProjectSelected);
manager->createNewPanel(Panels::West, tr("Project"), w);
manager->createNewPanel(Panels::West, "projectmamager", tr("Project"), w);

projectIssues = new ProjectIssuesWidget(manager);
manager->createNewPanel(Panels::South, tr("Issues"), projectIssues);
issuesDock = manager->createNewPanel(Panels::South, "projectissues", tr("Issues"), projectIssues);

auto *w2 = new QWidget;
outputPanel = new Ui::BuildRunOutput;
outputPanel->setupUi(w2);
manager->createNewPanel(Panels::South, tr("Output"), w2);
outputDock = manager->createNewPanel(Panels::South, "buildoutput", tr("Output"), w2);

connect(outputPanel->clearOutput, &QAbstractButton::clicked, this,
[this]() { this->outputPanel->commandOuput->clear(); });
Expand Down Expand Up @@ -299,7 +299,9 @@ void ProjectManagerPlugin::on_client_merged(qmdiHost *host) {
[this](int exitCode, QProcess::ExitStatus exitStatus) {
auto output = QString("[code=%1, status=%2]").arg(exitCode).arg(str(exitStatus));
this->outputPanel->commandOuput->appendPlainText(output);
getManager()->showPanel(Panels::South, 0);
getManager()->showPanels(Qt::BottomDockWidgetArea);
outputDock->raise();
outputDock->show();
});
connect(&runProcess, &QProcess::errorOccurred, this, [this](QProcess::ProcessError error) {
auto output = QString("[error: code=%1]").arg((int)error);
Expand Down Expand Up @@ -389,11 +391,13 @@ void ProjectManagerPlugin::on_client_merged(qmdiHost *host) {
});

searchPanelUI = new ProjectSearch(manager, directoryModel);
auto seachID = manager->createNewPanel(Panels::West, tr("Search"), searchPanelUI);
auto searchPanel = manager->createNewPanel(Panels::West, "search", tr("Search"), searchPanelUI);
auto projectSearch = new QAction(tr("Search in project"));
projectSearch->setShortcut(QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_F));
connect(projectSearch, &QAction::triggered, this, [seachID, manager, this]() {
manager->showPanel(Panels::West, seachID);
connect(projectSearch, &QAction::triggered, this, [searchPanel, this]() {
searchPanel->raise();
searchPanel->show();
searchPanel->setFocus();
searchPanelUI->setFocusOnSearch();
});
manager->addAction(projectSearch);
Expand Down Expand Up @@ -613,10 +617,11 @@ void ProjectManagerPlugin::do_runExecutable(const ExecutableInfo *info) {
workingDirectory = project->buildDir;
}
workingDirectory = expand(workingDirectory, hash);
getManager()->showPanel(Panels::South, 0);
outputPanel->commandOuput->clear();
outputPanel->commandOuput->appendPlainText("cd " + QDir::toNativeSeparators(workingDirectory));
outputPanel->commandOuput->appendPlainText(currentTask + "\n");
outputDock->raise();
outputDock->show();

auto command = QStringList();
auto interpreter = QString();
Expand Down Expand Up @@ -649,7 +654,8 @@ void ProjectManagerPlugin::do_runTask(const TaskInfo *task) {
auto currentTask = expand(task->command, hash);
auto workingDirectory = expand(task->runDirectory, hash);

getManager()->showPanel(Panels::South, 1);
outputDock->raise();
outputDock->show();
if (workingDirectory.isEmpty()) {
workingDirectory = project->buildDir;
}
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/ProjectManager/ProjectManagerPlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class ProjectManagerPlugin : public IPlugin {
int panelIndex = -1;
Ui::ProjectManagerGUI *gui = nullptr;
Ui::BuildRunOutput *outputPanel = nullptr;
QDockWidget* outputDock;
QDockWidget* issuesDock;
ProjectIssuesWidget *projectIssues = nullptr;

QFileSystemWatcher configWatcher;
Expand Down

0 comments on commit ab41f50

Please sign in to comment.