mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-06 15:04:34 +08:00
Bringing the AddNewTorrentDialog to the front.
This commit is contained in:
parent
89b82778e6
commit
b78ea79d30
@ -140,6 +140,13 @@ void AddNewTorrentDialog::showMagnet(const QString& link)
|
|||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddNewTorrentDialog::showEvent(QShowEvent *event) {
|
||||||
|
QDialog::showEvent(event);
|
||||||
|
activateWindow();
|
||||||
|
raise();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AddNewTorrentDialog::showAdvancedSettings(bool show)
|
void AddNewTorrentDialog::showAdvancedSettings(bool show)
|
||||||
{
|
{
|
||||||
if (show) {
|
if (show) {
|
||||||
|
@ -56,6 +56,9 @@ public:
|
|||||||
static void showTorrent(const QString& torrent_path, const QString& from_url = QString());
|
static void showTorrent(const QString& torrent_path, const QString& from_url = QString());
|
||||||
static void showMagnet(const QString& torrent_link);
|
static void showMagnet(const QString& torrent_link);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showAdvancedSettings(bool show);
|
void showAdvancedSettings(bool show);
|
||||||
void displayContentTreeMenu(const QPoint&);
|
void displayContentTreeMenu(const QPoint&);
|
||||||
|
@ -206,6 +206,13 @@ int main(int argc, char *argv[]) {
|
|||||||
if (app.isRunning()) {
|
if (app.isRunning()) {
|
||||||
qDebug("qBittorrent is already running for this user.");
|
qDebug("qBittorrent is already running for this user.");
|
||||||
// Read torrents given on command line
|
// Read torrents given on command line
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
DWORD pid = app.getRunningPid();
|
||||||
|
if (pid > 0) {
|
||||||
|
BOOL b = AllowSetForegroundWindow(pid);
|
||||||
|
qDebug("AllowSetForegroundWindow() returns %s", b ? "TRUE" : "FALSE");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
QStringList torrentCmdLine = app.arguments();
|
QStringList torrentCmdLine = app.arguments();
|
||||||
//Pass program parameters if any
|
//Pass program parameters if any
|
||||||
QString message;
|
QString message;
|
||||||
|
@ -263,14 +263,8 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
|
|||||||
// Load Window state and sizes
|
// Load Window state and sizes
|
||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
if (!ui_locked) {
|
if (systrayIcon) {
|
||||||
if (pref.startMinimized() && systrayIcon) {
|
if (!(pref.startMinimized() || ui_locked)) {
|
||||||
show();
|
|
||||||
minimizeWindow();
|
|
||||||
// XXX: Using showMinimized() makes it impossible to restore
|
|
||||||
// the window if "Minimize to systray" is enabled.
|
|
||||||
//showMinimized();
|
|
||||||
} else {
|
|
||||||
show();
|
show();
|
||||||
activateWindow();
|
activateWindow();
|
||||||
raise();
|
raise();
|
||||||
@ -323,10 +317,14 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Make sure the Window is visible if we don't have a tray icon
|
// Make sure the Window is visible if we don't have a tray icon
|
||||||
if (!systrayIcon && isHidden()) {
|
if (!systrayIcon) {
|
||||||
show();
|
if (pref.startMinimized()) {
|
||||||
activateWindow();
|
showMinimized();
|
||||||
raise();
|
} else {
|
||||||
|
show();
|
||||||
|
activateWindow();
|
||||||
|
raise();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user