Logo Search packages:      
Sourcecode: valknut version File versions  Download package

bool DCGuiApp::slotFileQuit (  )  [private, slot]

exits the application

Definition at line 1313 of file dcgui.cpp.

References DCSpy::DeInitDocument(), fileToolbar, m_pTimer, pTransferViewDock, queryExit(), viewStatusBar, viewTabBar, viewToolBar, and windowsTabBar.

Referenced by eventFilter(), initActions(), and slotTrayMenu().

{
      StringMap * map;
      StringMap * tabBarMap;

      statusBar()->message(tr("Exiting application..."));

      if ( g_pConfig->GetQueryOnExit() )
      {
            if ( queryExit() == false )
            {
                  statusBar()->message(tr("Exiting application... aborted"));
                  return FALSE;
            }
      }

      // shutdown all transfers
      g_pTransferView->DLM_Shutdown();
      // stop running searches
      g_pHubSearch->StopSearch();
      // close all clients
      g_pConnectionManager->DisconnectAllClients();

      while( (g_pTransferView->DLM_ShutdownState() != essSHUTDOWNREADY) ||
             (g_pHubSearch->IsSearch() == TRUE) ||
             (g_pConnectionManager->GetConnectedHubCount() > 0) )
      {
            qApp->processEvents();
#ifdef WIN32
            Sleep(100);
#else
            usleep(100);
#endif
      }

      // close all hub windows
      g_pConnectionManager->CloseDisconnectedHubs();

      g_pConfig->SetTabBar(viewTabBar->isOn());
      g_pConfig->SetToolBar(viewToolBar->isOn());
      g_pConfig->SetStatusBar(viewStatusBar->isOn());
      g_pConfig->SetAppGeometry( width(), height() );

      // save transfer view settings
      g_pConfig->GetMap("TRANSFERVIEW",map);

      (*map)["X"]      = QString().setNum(pTransferViewDock->x());
      (*map)["Y"]      = QString().setNum(pTransferViewDock->y());
      (*map)["WIDTH"]  = QString().setNum(pTransferViewDock->width());
      (*map)["HEIGHT"] = QString().setNum(pTransferViewDock->height());
      (*map)["DOCKED"] = QString().setNum((pTransferViewDock->area()!=0));
      
      Qt::Dock dock3;
      int index3;
      bool nl3;
      int extraOffset3;
      if ( getLocation( pTransferViewDock, dock3, index3, nl3, extraOffset3 ) == TRUE )
      {
            (*map)["DOCK"] = QString().setNum(dock3);
            
            QString nlstring;
            if (nl3 == TRUE)
            {
                  nlstring = "TRUE";
            }
            else
            {
                  nlstring = "FALSE";
            }
            
            (*map)["NL"] = nlstring;
            (*map)["INDEX"] = QString().setNum(index3);
            (*map)["EXTRAOFFSET"] = QString().setNum(extraOffset3);
      }     

      // save tabbar position and state
      g_pConfig->GetMap("TABBAR", tabBarMap);
      (*tabBarMap)["X"] = QString().setNum(windowsTabBar->x());
      (*tabBarMap)["Y"] = QString().setNum(windowsTabBar->y());
      (*tabBarMap)["WIDTH"]   = QString().setNum(windowsTabBar->width());
      (*tabBarMap)["HEIGHT"]  = QString().setNum(windowsTabBar->height());
      (*tabBarMap)["DOCKED"]  = QString().setNum((windowsTabBar->area()!=0));

      g_pConfig->SetShowTransferWin( pTransferViewDock->isVisible() );

      // save transfer list settings
      g_pTransferView->DeInitDocument();

      // save hub list settings
      g_pHubListManager->DeInitDocument();

      // save search view settings
      g_pHubSearch->DeInitDocument();

      // save spy view settings
      g_pSpy->DeInitDocument();

      // save user view settings
      g_pUsersList->DeInitDocument();

      // init main window
      g_pConfig->GetMap("MAINVIEW",map);
      (*map)["MAXIMIZED"] = QString().setNum(isMaximized());
      (*map)["DOCKED"]    = QString().setNum((fileToolbar->area()!=0));

      Qt::Dock dock;
      int index;
      bool nl;
      int  extraOffset;

      if ( getLocation( fileToolbar, dock, index, nl, extraOffset ) == TRUE )
      {
            (*map)["DOCK"] = QString().setNum(dock);
      }
      
      Qt::Dock dock2;
      int index2;
      bool nl2;
      int extraOffset2;
      
      if ( getLocation( windowsTabBar, dock2, index2, nl2, extraOffset2 ) == TRUE )
      {
            (*tabBarMap)["DOCK"] = QString().setNum(dock2);
            
            QString nlstring;
            if (nl2 == TRUE)
            {
                  nlstring = "TRUE";
            }
            else
            {
                  nlstring = "FALSE";
            }
            
            (*tabBarMap)["NL"] = nlstring;
            (*tabBarMap)["INDEX"] = QString().setNum(index2);
            (*tabBarMap)["EXTRAOFFSET"] = QString().setNum(extraOffset2);
      }

      // save gui config
      g_pConfig->SaveDCGui();

      m_pTimer->stop();

      qApp->quit();

      statusBar()->message(tr("Ready."));

      return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index