MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI) { ui->setupUi(this); //load the designer file //setupIcons(); ui->radio_apps->setChecked(true); //always default to starting here ui->tool_stop->setVisible(false); //no search running initially ui->tool_configure->setVisible(false); //app search initially set livetime = new QTimer(this); livetime->setInterval(300); //1/3 second for live searches livetime->setSingleShot(true); workthread = new QThread(this); workthread->setObjectName("Lumina Search Process"); searcher = new Worker(); searcher->moveToThread(workthread); closeShort = new QShortcut(QKeySequence(tr("Esc")), this); //Setup the connections connect(livetime, SIGNAL(timeout()), this, SLOT(startSearch()) ); connect(this, SIGNAL(SearchTerm(QString, bool)), searcher, SLOT(StartSearch(QString, bool)) ); connect(searcher, SIGNAL(FoundItem(QString)), this, SLOT(foundSearchItem(QString)) ); connect(searcher, SIGNAL(SearchUpdate(QString)), this, SLOT(searchMessage(QString)) ); connect(searcher, SIGNAL(SearchDone()), this, SLOT(searchFinished()) ); connect(ui->tool_stop, SIGNAL(clicked()), this, SLOT(stopSearch()) ); connect(ui->push_done, SIGNAL(clicked()), this, SLOT(closeApplication()) ); connect(ui->push_launch, SIGNAL(clicked()), this, SLOT(LaunchItem()) ); connect(ui->line_search, SIGNAL(textEdited(QString)), this, SLOT(searchChanged()) ); connect(ui->line_search, SIGNAL(returnPressed()), this, SLOT(LaunchItem()) ); connect(ui->radio_apps, SIGNAL(toggled(bool)), this, SLOT(searchTypeChanged()) ); connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(LaunchItem(QListWidgetItem*)) ); connect(ui->listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(LaunchItem(QListWidgetItem*)) ); connect(ui->tool_configure, SIGNAL(clicked()), this, SLOT(configureSearch()) ); connect(closeShort, SIGNAL(activated()), this, SLOT( close() ) ); //Setup the settings file QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); settings = new QSettings("LuminaDE", "lumina-search",this); searcher->startDir = settings->value("StartSearchDir", QDir::homePath()).toString(); searcher->skipDirs = settings->value("SkipSearchDirs", QStringList()).toStringList(); updateDefaultStatusTip(); this->show(); workthread->start(); QTimer::singleShot(0,this, SLOT(setupIcons()) ); }
void RazorTaskButton::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { if (this->isChecked()) { minimizeApplication(); } else { raiseApplication(); } } else if (mCloseOnMiddleClick && event->button() == Qt::MidButton) { closeApplication(); } }
void SignalManager::handleSignal() { snTerm->setEnabled(false); unsigned char signal_number = 0; read(sigtermFd[1], &signal_number, sizeof(signal_number)); // do Qt stuff if (signal_number == SIGUSR1) { QLOG_DEBUG() << "Received SIGUSR1, reloading config file"; SettingsComponent::Get().load(); } else { QLOG_DEBUG() << "Received signal, closing application"; closeApplication(); } snTerm->setEnabled(true); }
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); //load the designer file mousegrabbed = false; XCB = new LXCB(); IMG = new ImageEditor(this); ui->scrollArea->setWidget(IMG); ui->tabWidget->setCurrentWidget(ui->tab_view); ppath = QDir::homePath(); setupIcons(); ui->spin_monitor->setMaximum(QApplication::desktop()->screenCount()); if(ui->spin_monitor->maximum()<2){ ui->spin_monitor->setEnabled(false); ui->radio_monitor->setEnabled(false); } //Setup the connections connect(ui->tool_save, SIGNAL(clicked()), this, SLOT(saveScreenshot()) ); connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveScreenshot()) ); connect(ui->tool_quicksave, SIGNAL(clicked()), this, SLOT(quicksave()) ); connect(ui->actionQuick_Save, SIGNAL(triggered()), this, SLOT(quicksave()) ); connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeApplication()) ); connect(ui->push_snap, SIGNAL(clicked()), this, SLOT(startScreenshot()) ); connect(ui->actionTake_Screenshot, SIGNAL(triggered()), this, SLOT(startScreenshot()) ); connect(ui->tool_crop, SIGNAL(clicked()), IMG, SLOT(cropImage()) ); connect(IMG, SIGNAL(selectionChanged(bool)), this, SLOT(imgselchanged(bool)) ); settings = new QSettings("lumina-desktop", "lumina-screenshot",this); if(settings->value("screenshot-target", "window").toString() == "window") { ui->radio_window->setChecked(true); }else{ ui->radio_all->setChecked(true); } ui->spin_delay->setValue(settings->value("screenshot-delay", 0).toInt()); ui->tool_resize->setVisible(false); //not implemented yet this->show(); IMG->setDefaultSize(ui->scrollArea->maximumViewportSize()); IMG->LoadImage( QApplication::screens().at(0)->grabWindow(QApplication::desktop()->winId()).toImage() ); //initial screenshot //ui->label_screenshot->setPixmap( cpic.scaled(ui->label_screenshot->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) ); }
Control::Control() : end(this) { this->save = NULL; this->end.setText("Beenden"); this->menuList.setTitle("Aufnahme von:"); this->trayMenu.addAction(&end); this->sysIcon.setIcon(QIcon(":/icons/icon")); this->sysIcon.show(); this->sysIcon.setContextMenu(&trayMenu); connect(&end, SIGNAL(triggered()), this, SLOT(closeApplication())); connect(&this->signalMapper, SIGNAL(mapped(QString)), this, SLOT(openStreamSelectFile(QString))); //connect(&sysIcon, &QSystemTrayIcon::activated, this, &Control::trayIconClicked); }
void on_buttonMainCancel_clicked(void) { /*** Parameters start ***/ ST_ErrorCodeTbl errorInfo; // Error info. gint retVal = ID_ERR_NO_ERROR; // Return value. /*** Parameters end ***/ // Remove active print job. retVal = removeJob(gDestName); if (retVal != ID_ERR_NO_ERROR) { memset(&errorInfo, 0, sizeof(ST_ErrorCodeTbl)); getErrorCodeInfo(retVal, &errorInfo); if (errorInfo.errorLevel == ID_ERR_LEVEL_FATAL) { // Show error message on command line. outputCommandLineMessage(errorInfo.messageID); // Close application. closeApplication(); } } return; }// End on_buttonMainCancel_clicked
Application::~Application() { App::setQuiting(); window->setParent(0); anim::stopManager(); socket.close(); closeApplication(); App::deinitMedia(); mainApp = 0; delete updateReply; delete ::uploader; updateReply = 0; delete updateDownloader; updateDownloader = 0; delete updateThread; updateThread = 0; delete window; style::stopManager(); }
void MainWindow::setUpShortCuts() { auto ac = new QAction( this ) ; QList<QKeySequence> keys ; keys.append( Qt::Key_Enter ) ; keys.append( Qt::Key_Return ) ; ac->setShortcuts( keys ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( defaultButton() ) ) ; this->addAction( ac ) ; auto qa = new QAction( this ) ; QList<QKeySequence> z ; z.append( Qt::Key_M ) ; qa->setShortcuts( z ) ; connect( qa,SIGNAL( triggered() ),this,SLOT( pbMount() ) ) ; this->addAction( qa ) ; qa = new QAction( this ) ; QList<QKeySequence> p ; p.append( Qt::Key_U ) ; qa->setShortcuts( p ) ; connect( qa,SIGNAL( triggered() ),this,SLOT( pbUmount() ) ) ; this->addAction( qa ) ; qa = new QAction( this ) ; QList<QKeySequence> q ; q.append( Qt::Key_R ) ; qa->setShortcuts( q ) ; connect( qa,SIGNAL( triggered() ),this,SLOT( pbUpdate() ) ) ; this->addAction( qa ) ; qa = new QAction( this ) ; QList<QKeySequence> e ; e.append( Qt::Key_C ) ; qa->setShortcuts( e ) ; connect( qa,SIGNAL( triggered() ),this,SLOT( closeApplication() ) ) ; this->addAction( qa ) ; }
void on_mainWindow_destroy(void) { closeApplication(); return; }// End on_mainWindow_destroy
// Callback functions for Main Window. /////////////////////////////////////////////////////////////////////////////////////////// // void on_mainWindow_delete_event(void) { closeApplication(); return; }// End on_mainWindow_delete_event
void MainWindow::setUpApp( const QString& volume ) { this->setLocalizationLanguage() ; m_ui = new Ui::MainWindow ; m_ui->setupUi( this ) ; m_ui->pbunlockencfs->setMinimumHeight( 31 ) ; m_ui->pbmenu->setMinimumHeight( 31 ) ; m_ui->pbmount->setMinimumHeight( 31 ) ; m_ui->pbupdate->setMinimumHeight( 31 ) ; QVector<int> f = utility::getWindowDimensions( "zuluMount" ) ; int * e = f.data() ; this->window()->setGeometry( *( e + 0 ),*( e + 1 ),*( e + 2 ),*( e + 3 ) ) ; QTableWidget * table = m_ui->tableWidget ; table->setColumnWidth( 0,*( e + 4 ) ) ; table->setColumnWidth( 1,*( e + 5 ) ) ; table->setColumnWidth( 2,*( e + 6 ) ) ; table->setColumnWidth( 4,*( e + 7 ) ) ; table->setColumnWidth( 5,*( e + 8 ) ) ; m_ui->tableWidget->hideColumn( 3 ) ; #if QT_VERSION < QT_VERSION_CHECK( 5,0,0 ) m_ui->tableWidget->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ) ; #else m_ui->tableWidget->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents ) ; #endif m_ui->tableWidget->verticalHeader()->setMinimumSectionSize( 30 ) ; this->setAcceptDrops( true ) ; this->setWindowIcon( QIcon( ":/zuluMount.png" ) ) ; m_ui->tableWidget->setMouseTracking( true ) ; connect( m_ui->tableWidget,SIGNAL( itemEntered( QTableWidgetItem * ) ),this,SLOT( itemEntered( QTableWidgetItem * ) ) ) ; connect( m_ui->tableWidget,SIGNAL( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ), this,SLOT( slotCurrentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ) ) ; connect( m_ui->pbmount,SIGNAL( clicked() ),this,SLOT( pbMount() ) ) ; connect( m_ui->pbupdate,SIGNAL( clicked()),this,SLOT( pbUpdate() ) ) ; connect( m_ui->pbmenu,SIGNAL( clicked() ),this,SLOT( pbMenu() ) ) ; connect( m_ui->tableWidget,SIGNAL( itemClicked( QTableWidgetItem * ) ),this,SLOT( itemClicked( QTableWidgetItem * ) ) ) ; connect( m_ui->pbunlockencfs,SIGNAL( clicked() ),this,SLOT( unlockencfs() ) ) ; connect( this,SIGNAL( unlistVolume( QString ) ),this,SLOT( removeVolume( QString ) ) ) ; this->setUpShortCuts() ; this->setUpFont() ; m_trayIcon = new QSystemTrayIcon( this ) ; m_trayIcon->setIcon( QIcon( ":/zuluMount.png" ) ) ; auto trayMenu = new QMenu( this ) ; m_autoMountAction = new QAction( this ) ; m_autoMount = this->autoMount() ; m_autoMountAction->setCheckable( true ) ; m_autoMountAction->setChecked( m_autoMount ) ; m_autoMountAction->setText( tr( "Automount Volumes" ) ) ; connect( m_autoMountAction,SIGNAL( toggled( bool ) ),this,SLOT( autoMountToggled( bool ) ) ) ; trayMenu->addAction( m_autoMountAction ) ; auto autoOpenFolderOnMount = new QAction( this ) ; autoOpenFolderOnMount->setCheckable( true ) ; m_autoOpenFolderOnMount = this->autoOpenFolderOnMount() ; autoOpenFolderOnMount->setChecked( m_autoOpenFolderOnMount ) ; autoOpenFolderOnMount->setText( tr( "Auto Open Mount Point" ) ) ; connect( autoOpenFolderOnMount,SIGNAL( toggled( bool ) ),this,SLOT( autoOpenFolderOnMount( bool ) ) ) ; trayMenu->addAction( autoOpenFolderOnMount ) ; auto ac = new QAction( this ) ; ac->setText( tr( "Unmount All" ) ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( unMountAll() ) ) ; trayMenu->addAction( ac ) ; m_favorite_menu = trayMenu->addMenu( tr( "Favorites" ) ) ; connect( m_favorite_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( favoriteClicked( QAction * ) ) ) ; connect( m_favorite_menu,SIGNAL( aboutToShow() ),this,SLOT( showFavorites() ) ) ; m_not_hidden_volume_menu = trayMenu->addMenu( tr( "Hide Volume From View" ) ) ; connect( m_not_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromVisibleVolumeList( QAction * ) ) ) ; connect( m_not_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showVisibleVolumeList() ) ) ; m_hidden_volume_menu = trayMenu->addMenu( tr( "Unhide Volume From View" ) ) ; connect( m_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromHiddenVolumeList( QAction * ) ) ) ; connect( m_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showHiddenVolumeList() ) ) ; ac = new QAction( this ) ; ac->setText( tr( "Check For Update" ) ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( updateCheck() ) ) ; trayMenu->addAction( ac ) ; ac = new QAction( this ) ; ac->setText( tr( "About" ) ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( licenseInfo() ) ) ; trayMenu->addAction( ac ) ; trayMenu->addAction( tr( "Quit" ),this,SLOT( closeApplication() ) ) ; m_trayIcon->setContextMenu( trayMenu ) ; connect( m_trayIcon,SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), this,SLOT( slotTrayClicked( QSystemTrayIcon::ActivationReason ) ) ) ; m_ui->pbmenu->setMenu( m_trayIcon->contextMenu() ) ; m_trayIcon->show() ; QString dirPath = utility::homePath() + "/.zuluCrypt/" ; QDir dir( dirPath ) ; if( !dir.exists() ){ dir.mkdir( dirPath ) ; } this->disableAll() ; this->startAutoMonitor() ; this->updateVolumeList( zuluMountTask::updateVolumeList().await() ) ; if( volume.isEmpty() ) { this->enableAll() ; }else{ this->showMoungDialog( volume ) ; } this->autoUpdateCheck() ; }
/////////////////////////////////////////////////////////////////////////////////////////// // // CS : PRIVATE gboolean updateUI(pPrinterName) // IN : None. // OUT : None. // RETURN : Always TRUE. // //for Network Ver.3.00 PRIVATE gboolean updateUI(gchar *small_name) //PRIVATE gboolean updateUI(void) { /*** Parameters start ***/ ST_PrinterStatus printerStatus; // Printer status. ST_ErrorCodeTbl errorInfo; // Error info. gboolean jobExist = FALSE; // Flag for active job exist or not. gchar statusStr[1024]; // Buffer for printer status message. gboolean ctChanged = FALSE; // Flag for cartridge type changed or not. gboolean lpChanged = FALSE; // Flag for lever position changed or not. gboolean msgChanged = FALSE; // Flag for status messages changed or not. gboolean chdChanged = FALSE; // Flag for cartridge status changed or not. //ENUM_STSMessageID *pMessageID; // Pointer to array of message ID. gint retVal = ID_ERR_NO_ERROR; // Return value. struct timeb curTime; static struct timeb prevTime; static gboolean initTime = FALSE; //Ver.3.10 for Network output_dev __attribute__ ((unused)) Odev; char buf[4096]; /*** Parameters end ***/ int __attribute__ ((unused)) result2; //Ver.3.10 for Network memset( buf, 0x00, sizeof(buf) ) ; //20090202 inistialize memset( statusStr, 0x00, sizeof(statusStr) ) ; Odev.status = 0; Odev.dev = 0;//device_type; if (initTime == FALSE) { initTime = TRUE; } else { double diffSec; unsigned long diffMilliSec; ftime(&curTime); diffSec = difftime(curTime.time, prevTime.time); diffMilliSec = (unsigned long)(diffSec * 1000.0) + curTime.millitm - prevTime.millitm; if (diffMilliSec < TIMEOUT_CALL_UPDATE_UI_FUNC / 2) { return(TRUE); } } // Check printer and job. retVal = checkPrinterAndJobState(gDestName, NULL, &jobExist); if (retVal == ID_ERR_NO_ERROR) { //// Disable [Cancel Printing] button. //activateWidget(STR_MAIN_BUTTON_NAME_CANCEL, FALSE); //Ver.3.10 for Network //Child Process killed! //printf("jobExist %d\n",jobExist); if ( (jobExist == FALSE) && (*small_name == '\0') ) { retVal = ID_ERR_PRINT_JOB_NOT_EXIST; } else { // Get printer status string. getPrinterStatus(gDestName, statusStr, sizeof(statusStr)); retVal = getPrinterStatus(gDestName, statusStr, sizeof(statusStr)); // Ver.3.10 for Network if( *small_name != '\0' ){ //read from stdin //check stdin { fd_set rfds; struct timeval tv; int retval; /* 1s watch */ tv.tv_sec = 1; tv.tv_usec = 0; /* set fd=stdin (fd 0) */ FD_ZERO(&rfds); FD_SET(0, &rfds); /* stdin (fd 0) OK? */ retval = select(1, &rfds, NULL, NULL, &tv); if (retval > 0) result2 = read( 0, buf, sizeof(buf)); } //read( 0, buf, sizeof(buf)); if( buf[0] == '@' ){ retVal = ID_ERR__NO_RESPONSE; } else if( buf[0] == '*' ){ retVal = ID_ERR__COLLECTING_STATUS; } copy_buf2statusStr(&buf[1], (St_cupssts)&statusStr); //bscc2sts(small_name, &buf[1], &Odev, (Bscc2sts_tbl)&statusStr); } if (retVal == ID_ERR_NO_ERROR) { // Check status string. if (strncmp(statusStr, STR_HEADER_STATUS_STRING, strlen(STR_HEADER_STATUS_STRING)) == 0) { // Initialize printer status area. initPrinterStatus(&printerStatus); /* for Network Ver.3.10 */ if( buf[0] == '#' ) printerStatus.user_otherflag = NETWORK_OTHER_USE; // Get printer status information. retVal = translatePrinterStatus(statusStr, &printerStatus); if (retVal == ID_ERR_NO_ERROR) { // Enable [Cancel Printing] button. //if (gPrinterStatus.printInterface == ID_DEV_1284 ) // activateWidget(STR_MAIN_BUTTON_NAME_CANCEL, TRUE); // Check status changed or not. // Check cartridge class. if (memcmp(printerStatus.cartridgeClass, gPrinterStatus.cartridgeClass, sizeof(ST_CartridgeClass) * 2) != 0) { // Cartridge class changed. Update cartridge class area of UI. ctChanged = TRUE; } // Check lever position. if (printerStatus.leverPosition != gPrinterStatus.leverPosition) { // Lever position changed. Update lever position area of UI. lpChanged = TRUE; } // Check cartridge status. if (memcmp(printerStatus.cartridgeStatus, gPrinterStatus.cartridgeStatus, sizeof(ST_InkStatus) * CARTRIDGE_COLOR_TYPE_NUM) != 0) { // Cartridge status changed. Update cartridge pixmap area of UI. chdChanged = TRUE; } // Check number of messages. if (printerStatus.messageNum != gPrinterStatus.messageNum) { // Number of messages changed, then messages changed. Update messages area of UI. msgChanged = TRUE; } else if (printerStatus.messageNum > 0) { // Check messages and service call ID. if (memcmp(printerStatus.pMessageID, gPrinterStatus.pMessageID, sizeof(ENUM_STSMessageID) * printerStatus.messageNum) != 0) { // Messages changed. Update messages area of UI. msgChanged = TRUE; } else if (memcmp(printerStatus.serviceCallID, gPrinterStatus.serviceCallID, 4) != 0) { // Service call ID changed. Update messaegs area of UI. msgChanged = TRUE; } } // Update UI. updateUISettings(&printerStatus, ID_OTHER_MESSAGE_NONE, ctChanged, lpChanged, msgChanged, chdChanged); if (gPrinterStatus.pMessageID != NULL) { free(gPrinterStatus.pMessageID); gPrinterStatus.pMessageID = NULL; } memcpy(&gPrinterStatus, &printerStatus, sizeof(ST_PrinterStatus)); } } } } } if (retVal != ID_ERR_NO_ERROR) { // Check error. memset(&errorInfo, 0, sizeof(ST_ErrorCodeTbl)); getErrorCodeInfo(retVal, &errorInfo); if (errorInfo.errorLevel != ID_ERR_LEVEL_FATAL) { // Process continuing is possible. // Initialize printer status area. if (gPrinterStatus.pMessageID != NULL) { free(gPrinterStatus.pMessageID); } initPrinterStatus(&gPrinterStatus); // Update UI. updateUISettings(NULL, errorInfo.messageID, TRUE, TRUE, TRUE, TRUE); } else { // Show error message on command line. outputCommandLineMessage(errorInfo.messageID); // Close application. closeApplication(); } } ftime(&prevTime); return(TRUE); }// End updateUI
Application::Application(int &argc, char **argv) : PsApplication(argc, argv), serverName(psServerPrefix() + cGUIDStr()), closing(false), updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0) { DEBUG_LOG(("Application Info: creation..")); QByteArray d(QDir((cPlatform() == dbipWindows ? cExeDir() : cWorkingDir()).toLower()).absolutePath().toUtf8()); char h[33] = { 0 }; hashMd5Hex(d.constData(), d.size(), h); serverName = psServerPrefix() + h + '-' + cGUIDStr(); if (mainApp) { DEBUG_LOG(("Application Error: another Application was created, terminating..")); exit(0); } mainApp = this; installEventFilter(new _DebugWaiter(this)); #if defined Q_OS_LINUX || defined Q_OS_LINUX64 QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/DejaVuSans.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/NanumMyeongjo-Regular.ttf")); #endif QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Regular.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Bold.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Semibold.ttf")); float64 dpi = primaryScreen()->logicalDotsPerInch(); if (dpi <= 108) { // 0-96-108 cSetScreenScale(dbisOne); } else if (dpi <= 132) { // 108-120-132 cSetScreenScale(dbisOneAndQuarter); } else if (dpi <= 168) { // 132-144-168 cSetScreenScale(dbisOneAndHalf); } else { // 168-192-inf cSetScreenScale(dbisTwo); } if (devicePixelRatio() > 1) { cSetRetina(true); cSetRetinaFactor(devicePixelRatio()); cSetIntRetinaFactor(int32(cRetinaFactor())); } if (!cLangFile().isEmpty()) { LangLoaderPlain loader(cLangFile()); if (!loader.errors().isEmpty()) { LOG(("Lang load errors: %1").arg(loader.errors())); } else if (!loader.warnings().isEmpty()) { LOG(("Lang load warnings: %1").arg(loader.warnings())); } } Local::start(); style::startManager(); anim::startManager(); historyInit(); DEBUG_LOG(("Application Info: inited..")); window = new Window(); psInstallEventFilter(); connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected())); connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); connect(&socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SLOT(socketError(QLocalSocket::LocalSocketError))); connect(&socket, SIGNAL(bytesWritten(qint64)), this, SLOT(socketWritten(qint64))); connect(&socket, SIGNAL(readyRead()), this, SLOT(socketReading())); connect(&server, SIGNAL(newConnection()), this, SLOT(newInstanceConnected())); connect(this, SIGNAL(aboutToQuit()), this, SLOT(closeApplication())); connect(&updateCheckTimer, SIGNAL(timeout()), this, SLOT(startUpdateCheck())); connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed())); connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady())); connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState))); connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig())); writeUserConfigTimer.setSingleShot(true); connect(&killDownloadSessionsTimer, SIGNAL(timeout()), this, SLOT(killDownloadSessions())); if (cManyInstance()) { startApp(); } else { DEBUG_LOG(("Application Info: connecting local socket to %1..").arg(serverName)); socket.connectToServer(serverName); } }
TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model, QObject *parent) : QObject(parent), mVisibilityPublisher(TsProperty::KTsPath), mDismissRequestSubscriber(QString("%1/%2").arg(TsProperty::KTsPath).arg(TsProperty::KDismissRequestPath)) { bool ok(true); mLoader.load(KDocmlPath, &ok); Q_ASSERT(ok); HbDialog *dialog = qobject_cast<HbDialog *>(mLoader.findWidget("tsdevicedialog")); TsTasksGrid *grid = qobject_cast<TsTasksGrid *>(mLoader.findWidget("taskgrid")); Q_ASSERT(dialog); Q_ASSERT(grid); bool cssLoaded = HbStyleLoader::registerFilePath(":/resource/hbdialog.css"); Q_ASSERT(cssLoaded); { HbLabel *dialogHeading = qobject_cast<HbLabel *>(dialog->headingWidget()); Q_ASSERT(dialogHeading); HbFrameDrawer *headingFrame = new HbFrameDrawer(QLatin1String("qtg_fr_popup_heading"), HbFrameDrawer::ThreePiecesHorizontal); dialogHeading->setBackgroundItem(new HbFrameItem(headingFrame)); } grid->setEnabledAnimations(HbAbstractItemView::None); grid->setModel(model); changeOrientation(dialog->mainWindow()->orientation()); switchViewOnModelChange(); // needed because of Qt::QueuedConnection used below // @todo: check if we actually need queued connections qRegisterMetaType<QModelIndex>("QModelIndex"); // connect the grid and model connect(grid, SIGNAL(activated(QModelIndex)), model, SLOT(openApplication(QModelIndex))); connect(grid, SIGNAL(activated(QModelIndex)), dialog, SLOT(close())); connect(grid, SIGNAL(deleteButtonClicked(QModelIndex)), model, SLOT(closeApplication(QModelIndex)), Qt::QueuedConnection); connect(dialog->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(changeOrientation(Qt::Orientation))); connect(dialog, SIGNAL(aboutToClose()), this, SIGNAL(deviceDialogClosed())); // switch between grid and "no items" label when model is updated connect(model, SIGNAL(modelReset()), this, SLOT(switchViewOnModelChange())); connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange())); connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange())); connect(this, SIGNAL(deviceDialogClosed()), this, SLOT(notifyDialogClosed())); mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, static_cast<int>(true)); mVisibilityPublisher.sync(); connect(&mDismissRequestSubscriber, SIGNAL(contentsChanged()), this, SLOT(handleDismissRequest())); }
Application::Application(int &argc, char **argv) : PsApplication(argc, argv), serverName(psServerPrefix() + cGUIDStr()), closing(false), updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0) { if (mainApp) { DEBUG_LOG(("Application Error: another Application was created, terminating..")); exit(0); } mainApp = this; installEventFilter(new _DebugWaiter(this)); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/DejaVuSans.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Regular.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Bold.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Semibold.ttf")); float64 dpi = primaryScreen()->logicalDotsPerInch(); if (dpi <= 108) { // 0-96-108 cSetScreenScale(dbisOne); } else if (dpi <= 132) { // 108-120-132 cSetScreenScale(dbisOneAndQuarter); } else if (dpi <= 168) { // 132-144-168 cSetScreenScale(dbisOneAndHalf); } else { // 168-192-inf cSetScreenScale(dbisTwo); } if (devicePixelRatio() > 1) { cSetRetina(true); cSetRetinaFactor(devicePixelRatio()); cSetIntRetinaFactor(int32(cRetinaFactor())); } if (!cLangFile().isEmpty()) { LangLoaderPlain loader(cLangFile()); if (!loader.errors().isEmpty()) { LOG(("Lang load errors: %1").arg(loader.errors())); } else if (!loader.warnings().isEmpty()) { LOG(("Lang load warnings: %1").arg(loader.warnings())); } } style::startManager(); anim::startManager(); historyInit(); window = new Window(); psInstallEventFilter(); updateCheckTimer.setSingleShot(true); connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected())); connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); connect(&socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SLOT(socketError(QLocalSocket::LocalSocketError))); connect(&socket, SIGNAL(bytesWritten(qint64)), this, SLOT(socketWritten(qint64))); connect(&socket, SIGNAL(readyRead()), this, SLOT(socketReading())); connect(&server, SIGNAL(newConnection()), this, SLOT(newInstanceConnected())); connect(this, SIGNAL(aboutToQuit()), this, SLOT(closeApplication())); connect(&updateCheckTimer, SIGNAL(timeout()), this, SLOT(startUpdateCheck())); connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed())); connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady())); connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig())); writeUserConfigTimer.setSingleShot(true); if (cManyInstance()) { startApp(); } else { DEBUG_LOG(("Application Info: connecting local socket to %1..").arg(serverName)); socket.connectToServer(serverName); } }
slm_machine::slm_machine(QWidget *parent) : QMainWindow(parent), ui(new Ui::slm_machineClass) { /************************** UI and Buddy Management *******************************/ ui->setupUi(this); setProgressBarVisibility(false); //Buddy Management buddies = new buddyManager(); buddies->loadBuddiesAndIPs(); buddyModel = new QStringListModel(); buddyModel->setStringList(buddies->AliasBuddyList); ui->buddyList->setModel(buddyModel); ui->buddyList->setEditTriggers(QAbstractItemView::NoEditTriggers); this->setWindowTitle("SLM"); //UI connections connect(ui->addBuddyButton, SIGNAL(clicked()),this, SLOT(addBuddyPressed())); connect(ui->removeBuddyButton, SIGNAL(clicked()), this, SLOT(removeBuddypressed())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(closeApplication())); connect(ui->buddyList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(buddyPressed(QModelIndex))); connect(ui->actionAbout_Qt, SIGNAL(triggered()), this, SLOT(aboutQTPressed())); connect(ui->actionAbout_SLM, SIGNAL(triggered()), this, SLOT(aboutSLMPressed())); connect(ui->actionEncryption_Key, SIGNAL(triggered()), this, SLOT(encryptionKeyPressed())); /************************************************************************************/ /************************** Message Server Management *******************************/ messageServer = slm_server::getInstance(); connect(messageServer, SIGNAL(sendtoUI(QByteArray,QHostAddress)),this,SLOT(messageHandler(QByteArray,QHostAddress))); /************************************************************************************/ /***************************** File Server Management *******************************/ onGoingFileTransfer = false; FServer = new fileServer(); //File Server Connections connect(FServer,SIGNAL(newDocumentArrived(QString,QString,quint32,quint8)),this,SLOT(incomingFileSlot(QString,QString,quint32,quint8)),Qt::QueuedConnection); connect(FServer,SIGNAL(transferCompleted(QString)),this,SLOT(incomingFileTransferCompleted(QString)),Qt::QueuedConnection); connect(FServer,SIGNAL(transferCanceled()),this,SLOT(transferIsCancelled()),Qt::QueuedConnection); connect(FServer,SIGNAL(ongoingTransfer()),this,SLOT(ongoingTransferExists()),Qt::QueuedConnection); connect(FServer,SIGNAL(receivingProgress(quint32)),this,SLOT(updateReceivingProgress(quint32)),Qt::QueuedConnection); //Start the File Server Thread FServer->start(); /***********************************************************************************/ /***************************** Buddy List Right Click *******************************/ checkOnline = new QAction(tr("&Check Online"), this); checkOnline->setIcon(QIcon(":/icons/CheckOnline")); rightClickUserMenu = new QMenu(); rightClickUserMenu->addAction(checkOnline); connect(checkOnline,SIGNAL(triggered()),this,SLOT(checkUserOnline())); ui->buddyList->installEventFilter(this); /***********************************************************************************/ /***************************** Tray Icon Management ********************************/ //Create tray icon and contex menu actions this->createActions(); this->createTrayIcon(); //Tray Icon Connections connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); connect(this, SIGNAL(signalPlaceToTray()),this, SLOT(slotPlaceToTray()),Qt::QueuedConnection); //Show application icon in the tray trayIcon->setIcon(QIcon(":/icons/SLM_Logo")); trayIcon->setToolTip("SLM (SMG Lan Messenger)"); trayIcon->show(); /**********************************************************************************/ }
void EventManager::fireCloseApplicationEvent(const CloseApplicationEvent& event) { emit closeApplication(CloseApplicationEvent(event)); }