-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Export the launcher dialog as a shared library
- Loading branch information
Showing
11 changed files
with
202 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
launcherdialog.cpp | ||
This file is part of GammaRay, the Qt application inspection and | ||
manipulation tool. | ||
Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected] | ||
Author: Giulio Camuffo <[email protected]> | ||
Licensees holding valid commercial KDAB GammaRay licenses may use this file in | ||
accordance with GammaRay Commercial License Agreement provided with the Software. | ||
Contact [email protected] if any conditions of this licensing are not clear to you. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <QDialog> | ||
|
||
#include "launcherdialog.h" | ||
#include "launcherwindow.h" | ||
#include "ui_launcherwindow.h" | ||
|
||
namespace GammaRay { | ||
|
||
LauncherDialog::Result LauncherDialog::exec(Mode mode) | ||
{ | ||
LauncherWindow launcher(false); | ||
launcher.ui->tabWidget->removeTab(launcher.ui->tabWidget->indexOf(launcher.ui->launchPage)); | ||
|
||
switch (mode) { | ||
case Mode::Connect: | ||
launcher.ui->tabWidget->setCurrentWidget(launcher.ui->connectPage); | ||
break; | ||
case Mode::Attach: | ||
launcher.ui->tabWidget->setCurrentWidget(launcher.ui->attachPage); | ||
break; | ||
} | ||
|
||
int ret = launcher.exec(); | ||
Result result; | ||
result.m_valid = ret == QDialog::Accepted; | ||
|
||
QWidget *current = launcher.ui->tabWidget->currentWidget(); | ||
if (current == launcher.ui->connectPage) { | ||
result.m_mode = Mode::Connect; | ||
} else if (current == launcher.ui->attachPage) { | ||
result.m_mode = Mode::Attach; | ||
} else { | ||
result.m_valid = false; | ||
return result; | ||
} | ||
|
||
switch (result.m_mode) { | ||
case Mode::Connect: | ||
result.m_url = launcher.ui->connectPage->url(); | ||
break; | ||
case Mode::Attach: | ||
result.m_procPid = launcher.ui->attachPage->pid(); | ||
result.m_procExe = launcher.ui->attachPage->name(); | ||
break; | ||
} | ||
|
||
|
||
return result; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
launcherdialog.h | ||
This file is part of GammaRay, the Qt application inspection and | ||
manipulation tool. | ||
Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected] | ||
Author: Giulio Camuffo <[email protected]> | ||
Licensees holding valid commercial KDAB GammaRay licenses may use this file in | ||
accordance with GammaRay Commercial License Agreement provided with the Software. | ||
Contact [email protected] if any conditions of this licensing are not clear to you. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef GAMMARAY_LAUNCHERDIALOG_H | ||
#define GAMMARAY_LAUNCHERDIALOG_H | ||
|
||
#include <QObject> | ||
#include <QUrl> | ||
|
||
#include "gammaray_launcher_dialog_export.h" | ||
|
||
namespace GammaRay { | ||
|
||
class GAMMARAY_LAUNCHER_DIALOG_EXPORT LauncherDialog : public QObject | ||
{ | ||
public: | ||
enum class Mode { | ||
Connect, | ||
Attach, | ||
}; | ||
|
||
class Result | ||
{ | ||
public: | ||
operator bool() const { return m_valid; } | ||
|
||
Mode mode() const { return m_mode; } | ||
|
||
QUrl url() const { return m_url; } | ||
|
||
QString processExe() const { return m_procExe; } | ||
qint64 processPid() const { return m_procPid; } | ||
|
||
private: | ||
bool m_valid; | ||
Mode m_mode; | ||
QUrl m_url; | ||
QString m_procExe; | ||
qint64 m_procPid; | ||
friend class LauncherDialog; | ||
}; | ||
|
||
Result exec(Mode mode); | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters