From: Eric Bollengier Date: Tue, 11 Aug 2009 09:36:25 +0000 (+0200) Subject: connect button callback X-Git-Tag: Release-7.0.0~2650^2~13^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=56154332b6ccf8397bced18f312191aa9c0506c1;p=bacula%2Fbacula connect button callback --- diff --git a/bacula/src/qt-console/storage/content.cpp b/bacula/src/qt-console/storage/content.cpp index 8c42aedd48..6b8c1a40d5 100644 --- a/bacula/src/qt-console/storage/content.cpp +++ b/bacula/src/qt-console/storage/content.cpp @@ -48,10 +48,68 @@ Content::Content(QString storage) m_closeable = true; m_currentStorage = storage; + connect(pbUpdate, SIGNAL(clicked()), this, + SLOT(consoleUpdateSlots())); + + connect(pbLabel, SIGNAL(clicked()), this, + SLOT(consoleLabelStorage())); + + connect(pbMount, SIGNAL(clicked()), this, + SLOT(consoleMountStorage())); + + connect(pbUnmount, SIGNAL(clicked()), this, + SLOT(consoleUnMountStorage())); + + connect(pbStatus, SIGNAL(clicked()), this, + SLOT(statusStorageWindow())); + + connect(pbRelease, SIGNAL(clicked()), this, + SLOT(consoleRelease())); + dockPage(); setCurrent(); } +/* Label Media populating current storage by default */ +void Content::consoleLabelStorage() +{ + new labelPage(m_currentStorage); +} + +/* Mount currently selected storage */ +void Content::consoleMountStorage() +{ + setConsoleCurrent(); + /* if this storage is an autochanger, lets ask for the slot */ + new mountDialog(m_console, m_currentStorage); +} + +/* Unmount Currently selected storage */ +void Content::consoleUnMountStorage() +{ + QString cmd("umount storage="); + cmd += m_currentStorage; + consoleCommand(cmd); +} + +void Content::statusStorageWindow() +{ + /* if one exists, then just set it current */ + bool found = false; + foreach(Pages *page, mainWin->m_pagehash) { + if (mainWin->currentConsole() == page->console()) { + if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) { + found = true; + page->setCurrent(); + } + } + } + if (!found) { + QTreeWidgetItem *parentItem = mainWin->getFromHash(this); + new StorStat(m_currentStorage, parentItem); + } +} + /* * The main meat of the class!! The function that querries the director and * creates the widgets with appropriate values. @@ -158,68 +216,20 @@ void Content::currentStackItem() } } -/* - * Functions to respond to local context sensitive menu sending console - * commands If I could figure out how to make these one function passing a - * string, Yaaaaaa - */ -void Content::consoleStatusStorage() -{ - QString cmd("status storage="); - cmd += m_currentStorage; - consoleCommand(cmd); -} - -/* Label Media populating current storage by default */ -void Content::consoleLabelStorage() -{ - new labelPage(m_currentStorage); -} - void Content::treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *) { } -/* Mount currently selected storage */ -void Content::consoleMountStorage() -{ - if (m_currentAutoChanger == 0){ - /* no autochanger, just execute the command in the console */ - QString cmd("mount storage="); - cmd += m_currentStorage; - consoleCommand(cmd); - } else { - setConsoleCurrent(); - /* if this storage is an autochanger, lets ask for the slot */ - new mountDialog(m_console, m_currentStorage); - } -} - -/* Unmount Currently selected storage */ -void Content::consoleUnMountStorage() -{ - QString cmd("umount storage="); - cmd += m_currentStorage; - consoleCommand(cmd); -} - /* Update Slots */ void Content::consoleUpdateSlots() { + // TODO: get selected slots QString cmd("update slots storage="); cmd += m_currentStorage; consoleCommand(cmd); } -/* Update Slots Scan*/ -void Content::consoleUpdateSlotsScan() -{ - QString cmd("update slots scan storage="); - cmd += m_currentStorage; - consoleCommand(cmd); -} - /* Release a tape in the drive */ void Content::consoleRelease() { @@ -227,24 +237,3 @@ void Content::consoleRelease() cmd += m_currentStorage; consoleCommand(cmd); } - -/* - * Open a status storage window - */ -void Content::statusStorageWindow() -{ - /* if one exists, then just set it current */ - bool found = false; - foreach(Pages *page, mainWin->m_pagehash) { - if (mainWin->currentConsole() == page->console()) { - if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) { - found = true; - page->setCurrent(); - } - } - } - if (!found) { - QTreeWidgetItem *parentItem = mainWin->getFromHash(this); - new StorStat(m_currentStorage, parentItem); - } -} diff --git a/bacula/src/qt-console/storage/content.h b/bacula/src/qt-console/storage/content.h index a4abad4953..b4cf68bc75 100644 --- a/bacula/src/qt-console/storage/content.h +++ b/bacula/src/qt-console/storage/content.h @@ -41,17 +41,16 @@ public: Content(QString storage); // virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); - void consoleUnMountStorage(); + +public slots: + void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); + + void consoleRelease(); void consoleUpdateSlots(); - void consoleUpdateSlotsScan(); void consoleLabelStorage(); - void consoleStatusStorage(); void consoleMountStorage(); void statusStorageWindow(); - void consoleRelease(); - -public slots: - void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); + void consoleUnMountStorage(); private slots: void populateContent(); diff --git a/bacula/src/qt-console/storage/content.ui b/bacula/src/qt-console/storage/content.ui index ad6c540f32..db53fe4834 100644 --- a/bacula/src/qt-console/storage/content.ui +++ b/bacula/src/qt-console/storage/content.ui @@ -36,7 +36,7 @@ - Update + Update slots :/images/view-refresh.png @@ -55,6 +55,9 @@ + + false + Move to tray @@ -65,6 +68,9 @@ + + false + Empty tray @@ -74,19 +80,33 @@ - + Mount - + Unmount + + + + Status + + + + + + + Release + + +