MainWindow::MainWindow(QWidget *parent): QWidget(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint) { active_index_ = -1; edit_index_ = -1; animation_id_ = 0; stats_ = new StatsDialog(); connect(this, SIGNAL(cycleReadySignal()), stats_, SLOT(cycleReady())); if (!which("firejail")) { QMessageBox::warning(this, tr("Firejail Tools"), tr("<br/><b>Firejail</b> sandbox not found.<br/><br/><br/>")); exit(1); } applications_init(); createTrayActions(); createLocalActions(); thread_ = new PidThread(); connect(thread_, SIGNAL(cycleReady()), this, SLOT(cycleReady())); setContextMenuPolicy(Qt::ActionsContextMenu); setToolTip(tr("Double click on an icon to open an application.\n" "Drag the launcher with the left mouse button.\n" "Use the right mouse button to open a context menu.")); setWindowTitle(tr("Firejail Tools")); }
AutoFileBackup::AutoFileBackup(QWidget *parent) : QWidget(parent), ui(new Ui::AutoFileBackup) { createTrayActions(); createTrayIcon(); setTrayIcon(); trayIcon->show(); /* QString myPath = QCoreApplication::applicationDirPath() + QDir::separator() + "lib" + QDir::separator() + "fonts" ; QFileInfo fontsdir; (myPath); fontsdir.dir().mkpath(myPath ); qDebug() << myPath; QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert("LD_LIBRARY_PATH", myPath ); env.insert("QT_QPA_FONTDIR", myPath ); // Load the embedded font. QString fontPath = ":/fonts/DejaVuSans.ttf"; // QFontDatabase::removeAllApplicationFonts(); int fontId = QFontDatabase::addApplicationFont(fontPath); QFont font("DejaVu Sans",9); // font.setStyleName("Regular"); this->setFont(font); qDebug() << fontId ; qDebug() << QWidget::fontInfo().family(); qDebug() << QWidget::fontInfo().styleName(); qDebug() << QWidget::fontInfo().style(); QFontDatabase db1; qDebug() << db1.families(); */ setWindowIcon(QIcon(":/images/backup_ico.png")); ui->setupUi(this); folderMonitor = new QFileSystemWatcher(this); fileMonitor = new QFileSystemWatcher(this); connect(fileMonitor, SIGNAL(fileChanged(const QString &)), this, SLOT(fileChanged(const QString &))); connect(folderMonitor, SIGNAL(directoryChanged(const QString &)), this, SLOT(directoryChanged(const QString &))); connect(ui->watchedFilesTableWidget,SIGNAL(dropped(const QMimeData*)), this , SLOT(on_watchedFilesTableWidget_dropped(const QMimeData *))); QCoreApplication::setOrganizationName("Stalin"); // QCoreApplication::setOrganizationDomain("mysoft.com"); QCoreApplication::setApplicationName("Auto File Backup"); // ui->watchedFilesTableWidget->AdjustToContents; ui->watchedFilesTableWidget->setColumnWidth(0, 500); ui->watchedFilesTableWidget->setColumnWidth(1, 100); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), localServer(0), bHasActivated(false), cardUpdateProcess(0) { connect(settingsCache, SIGNAL(pixmapCacheSizeChanged(int)), this, SLOT(pixmapCacheSizeChanged(int))); pixmapCacheSizeChanged(settingsCache->getPixmapCacheSize()); client = new RemoteClient; connect(client, SIGNAL(connectionClosedEventReceived(const Event_ConnectionClosed &)), this, SLOT(processConnectionClosedEvent(const Event_ConnectionClosed &))); connect(client, SIGNAL(serverShutdownEventReceived(const Event_ServerShutdown &)), this, SLOT(processServerShutdownEvent(const Event_ServerShutdown &))); connect(client, SIGNAL(loginError(Response::ResponseCode, QString, quint32)), this, SLOT(loginError(Response::ResponseCode, QString, quint32))); connect(client, SIGNAL(socketError(const QString &)), this, SLOT(socketError(const QString &))); connect(client, SIGNAL(serverTimeout()), this, SLOT(serverTimeout())); connect(client, SIGNAL(statusChanged(ClientStatus)), this, SLOT(statusChanged(ClientStatus))); connect(client, SIGNAL(protocolVersionMismatch(int, int)), this, SLOT(protocolVersionMismatch(int, int))); connect(client, SIGNAL(userInfoChanged(const ServerInfo_User &)), this, SLOT(userInfoReceived(const ServerInfo_User &)), Qt::BlockingQueuedConnection); connect(client, SIGNAL(registerAccepted()), this, SLOT(registerAccepted())); connect(client, SIGNAL(registerAcceptedNeedsActivate()), this, SLOT(registerAcceptedNeedsActivate())); connect(client, SIGNAL(registerError(Response::ResponseCode, QString, quint32)), this, SLOT(registerError(Response::ResponseCode, QString, quint32))); connect(client, SIGNAL(activateAccepted()), this, SLOT(activateAccepted())); connect(client, SIGNAL(activateError()), this, SLOT(activateError())); clientThread = new QThread(this); client->moveToThread(clientThread); clientThread->start(); createActions(); createMenus(); tabSupervisor = new TabSupervisor(client); connect(tabSupervisor, SIGNAL(setMenu(QList<QMenu *>)), this, SLOT(updateTabMenu(QList<QMenu *>))); connect(tabSupervisor, SIGNAL(localGameEnded()), this, SLOT(localGameEnded())); connect(tabSupervisor, SIGNAL(maximize()), this, SLOT(maximize())); tabSupervisor->addDeckEditorTab(0); setCentralWidget(tabSupervisor); retranslateUi(); resize(900, 700); restoreGeometry(settingsCache->getMainWindowGeometry()); aFullScreen->setChecked(windowState() & Qt::WindowFullScreen); if (QSystemTrayIcon::isSystemTrayAvailable()) { createTrayActions(); createTrayIcon(); } connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts())); refreshShortcuts(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //--------------------------------------------- setAcceptDrops(true); //--------------------------------------------- this->pTimer = new QTimer(this); this->statusBarTimer = new QTimer(this); this->shutdownTimer = new QTimer(this); this->settings = new AppSettings(this); //--------------------------------------------- connect(this->pTimer,SIGNAL(timeout()),this,SLOT(timer_toggle())); connect(this->shutdownTimer, SIGNAL(timeout()),this, SLOT(shutdown_timer_toggle())); connect(this->statusBarTimer, SIGNAL(timeout()),this, SLOT(statusBar_timer_toggle())); // init class variables this->shortCutsDialog = NULL; this->progress_value=0; this->timeoutForShowTrayMessage = 10; this->config_msg=false; this->check_access=false; //--------------------------------------------- ui->timeEdit->setFocusPolicy(Qt::WheelFocus); ui->spinBox->setFocusPolicy(Qt::WheelFocus); ui->spinBox_2->setFocusPolicy(Qt::WheelFocus); //--------------------------------------------- loadAndApplyAllSettings(); setWidgetFrom_CencelStop(true); int comboBoxCurrentIndex = ui->comboBox->currentIndex(); switch(comboBoxCurrentIndex) { case(0): { setWidgetFrom_AtTime(); } break; case(1): { setWidgetFrom_AfterADelay(); } break; case(2): { setWidgetFrom_Mplayer(); } break; default: { qDebug() << "on_comboBox_currentIndexChanged UNKNOWN index: " << comboBoxCurrentIndex; } break; } //-------------------------------------------- // set form geometry QRect geometry = this->geometry(); qDebug() << geometry; this->setFixedSize(geometry.width(),geometry.height()); //QRect(496,175 260x314) //-------------------------------------------- // start periodic timer pTimer->start(1000); checkSudoAccess(); pidofQzleepDublicateCheck(); //------------------------------------------------------------------ // tray icon init createTrayActions(); createTrayIcon(); trayIcon->show(); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); //------------------------------------------------------------------ // open with qzleep this->mplayerProcess = NULL; int argc_var = QCoreApplication::argc(); char ** argv_var = QCoreApplication::argv(); this->mplayerProcess = new MplayerProcess(this); connect(this->mplayerProcess,SIGNAL(signalMpleyerProgres(int)),this,SLOT(slotMplayerProgessUpdate(int))); connect(this->mplayerProcess,SIGNAL(finished(int)),this,SLOT(slotMplayerProcessFinished(int))); if(argc_var>1) { qDebug() << "1 [" << *(argv_var+1) << "]" << endl; optionMplayer(*(argv_var+1)); } //--------------------------------------------- }