MusicDesktopWallpaperWidget::MusicDesktopWallpaperWidget(QWidget *parent)
    : MusicAbstractMoveWidget(parent),
      ui(new Ui::MusicDesktopWallpaperWidget)
{
    ui->setupUi(this);

    setAttribute(Qt::WA_DeleteOnClose);
    setAttribute(Qt::WA_TranslucentBackground);

    ui->topTitleCloseButton->setIcon(QIcon(":/share/searchclosed"));
    ui->topTitleCloseButton->setStyleSheet(MusicUIObject::MToolButtonStyle03);
    ui->topTitleCloseButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->topTitleCloseButton->setToolTip(tr("Close"));
    connect(ui->topTitleCloseButton, SIGNAL(clicked()), SLOT(close()));

    initWidgetStyle();
    initParameters();

    connect(ui->netRadioButton, SIGNAL(clicked()), SLOT(netRadioButtonPressed()));
    connect(ui->localRadioButton, SIGNAL(clicked()), SLOT(localRadioButtonPressed()));
    connect(ui->playRadioButton, SIGNAL(clicked()), SLOT(playRadioButtonPressed()));

    connect(ui->viewButton, SIGNAL(clicked()), SLOT(viewButtonPressed()));
    connect(ui->confirmButton, SIGNAL(clicked()), SLOT(confirmButtonPressed()));
    connect(ui->stopButton, SIGNAL(clicked()), SLOT(stopButtonPressed()));
    connect(ui->cancelButton, SIGNAL(clicked()), SLOT(cancelButtonPressed()));

    ui->localRadioButton->setChecked(true);
    localRadioButtonPressed();

    m_wallThread = new MusicDesktopWallpaperThread(this);
}
예제 #2
0
DataImporterImportPage::DataImporterImportPage(DbUiManager *uiManager, QWidget *parent) :
    ConnectionPageWizardPage(uiManager, parent), queryScheduler(0), workerThread(0)
{
    setTitle(tr("Importing..."));
    setSubTitle(tr("Data import is in progress"));
    setFinalPage(true);

    QHBoxLayout *mainLayout = new QHBoxLayout();

    QVBoxLayout *centerLayout = new QVBoxLayout();

    statusLabel = new QLabel(tr("Starting..."));
    centerLayout->addWidget(statusLabel);

    stopButton = new QPushButton(IconUtil::getIcon("stop"), tr("Stop"));
    centerLayout->addWidget(stopButton);
    stopButton->setVisible(false);

    mainLayout->addLayout(centerLayout);
    mainLayout->setAlignment(centerLayout, Qt::AlignCenter);
    setLayout(mainLayout);

    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    connect(stopButton, SIGNAL(clicked()), this, SLOT(stopButtonPressed()));
}
예제 #3
0
파일: rotor.cpp 프로젝트: kmjonsson/pirotor
Rotor::Rotor(QSettings *settings, RotorButtons *buttons,QWidget *parent)
    : QWidget(parent)
{
	this->settings = settings;
	this->buttons = buttons;

	// Update timer
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(fetchStatus()));
    timer->start(1000*settings->value("System/statusInterval",300).toInt());

    dir = -1;
    aim = -1;

	// Buttons init
	connect(buttons,SIGNAL(goButtonPressed(int)),this,SLOT(goAntenna(int)));
	connect(buttons,SIGNAL(gotoButtonPressed(int)),this,SLOT(aimAntenna(int)));
	connect(buttons,SIGNAL(stopButtonPressed()),this,SLOT(stopAntenna()));

	// MMQ Init
    mmq = new MMQ(this);
    connect(mmq, SIGNAL(connected()),this, SLOT(connected()));
    connect(mmq, SIGNAL(authenticated()),this, SLOT(authenticated()));
    connect(mmq, SIGNAL(packet(QString,QJsonValue)),this, SLOT(packet(QString,QJsonValue)));
    connect(mmq, SIGNAL(disconnected()),this, SLOT(disconnected()));
    connect(mmq, SIGNAL(error(qint64)),this, SLOT(error(qint64)));

    mmq->setKey(settings->value("System/password").toString());
    mmq->doConnect(
			settings->value("System/hostname",QString("localhost")).toString(),
			settings->value("System/port",4343).toInt());
 
	// Load rotor Image
    rotorImg = QImage(settings->value("System/backgroundImage",QString("rotor.png")).toString());
    Q_ASSERT(!img.isNull());
}
예제 #4
0
MainWindow::MainWindow(bool verbose, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //initialisation
    verboseOutput = verbose;
    if (verboseOutput) {
        qDebug() << "Verbose Enabled.";
    }
#ifdef Q_OS_WIN
    jsonconfigFile = QCoreApplication::applicationDirPath() + "/gui-config.json";
#else
    QDir ssConfigDir = QDir::homePath() + "/.config/shadowsocks";
    jsonconfigFile = ssConfigDir.absolutePath() + "/gui-config.json";
    if (!ssConfigDir.exists()) {
        ssConfigDir.mkpath(ssConfigDir.absolutePath());
    }
#endif
    m_conf = new Configuration(jsonconfigFile);

    ui->laddrEdit->setValidator(&ipv4addrValidator);
    ui->lportEdit->setValidator(&portValidator);
    ui->methodComboBox->addItems(SSValidator::supportedMethod);
    ui->profileComboBox->addItems(m_conf->getProfileList());
    ui->sportEdit->setValidator(&portValidator);
    ui->stopButton->setEnabled(false);

    ui->autohideCheck->setChecked(m_conf->isAutoHide());
    ui->autostartCheck->setChecked(m_conf->isAutoStart());
    ui->debugCheck->setChecked(m_conf->isDebug());
#ifdef Q_OS_LINUX
    ui->translucentCheck->setVisible(false);
#else
    ui->translucentCheck->setChecked(m_conf->isTranslucent());
    if(m_conf->isTranslucent()) {
        this->setAttribute(Qt::WA_TranslucentBackground);
    }
    ui->tfoCheckBox->setVisible(false);
#endif
    ui->relativePathCheck->setChecked(m_conf->isRelativePath());

    //desktop systray
    systrayMenu.addAction(tr("Show"), this, SLOT(showWindow()));
    systrayMenu.addAction(tr("Start"), this, SLOT(startButtonPressed()));
    systrayMenu.addAction(tr("Stop"), this, SLOT(stopButtonPressed()));
    systrayMenu.addAction(tr("Exit"), this, SLOT(close()));
    systrayMenu.actions().at(2)->setEnabled(false);
#ifdef Q_OS_WIN
    systray.setIcon(QIcon(":/icon/black_icon.png"));
#else
    systray.setIcon(QIcon(":/icon/mono_icon.png"));
#endif
    systray.setToolTip(QString("Shadowsocks-Qt5"));
    systray.setContextMenu(&systrayMenu);
#ifdef Q_OS_LINUX
    isUbuntuUnity = (QString(getenv("XDG_CURRENT_DESKTOP")).compare("Unity", Qt::CaseInsensitive) == 0);
    if (!isUbuntuUnity) {
        systray.show();
    }
#else
    systray.show();
#endif

    //Windows Extras
#ifdef Q_OS_WIN
    QtWin::enableBlurBehindWindow(this);
    QtWin::extendFrameIntoClientArea(this, -1, -1, -1, -1);
    //smaller margins
    ui->verticalLayout->setMargin(4);//centralwidget
#endif

    //Move to the center of the screen
    this->move(QApplication::desktop()->screen()->rect().center() - this->rect().center());

    /*
     * SIGNALs and SLOTs
     */
    connect(&ss_local, &SS_Process::readReadyProcess, this, &MainWindow::onReadReadyProcess);
    connect(&ss_local, &SS_Process::sigstart, this, &MainWindow::processStarted);
    connect(&ss_local, &SS_Process::sigstop, this, &MainWindow::processStopped);
    connect(&systray, &QSystemTrayIcon::activated, this, &MainWindow::systrayActivated);

    connect(ui->backendToolButton, &QToolButton::clicked, this, &MainWindow::onBackendToolButtonPressed);

    /*
     * I believe there's bug. see https://bugreports.qt-project.org/browse/QTBUG-41863
     * before it's fixed, let's use old way to work around.
     *
    connect(ui->profileComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MainWindow::onCurrentProfileChanged);
    */
    connect(ui->profileComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentProfileChanged(int)));

    connect(ui->backendTypeCombo, &QComboBox::currentTextChanged, this, &MainWindow::backendTypeChanged);
    connect(ui->addProfileButton, &QToolButton::clicked, this, &MainWindow::addProfileDialogue);
    connect(ui->delProfileButton, &QToolButton::clicked, this, &MainWindow::deleteProfile);
    connect(ui->startButton, &QPushButton::clicked, this, &MainWindow::startButtonPressed);
    connect(ui->stopButton, &QPushButton::clicked, this, &MainWindow::stopButtonPressed);
    connect(ui->shareButton, &QPushButton::clicked, this, &MainWindow::onShareButtonClicked);

    connect(this, &MainWindow::configurationChanged, this, &MainWindow::onConfigurationChanged);
    connect(ui->customArgEdit, &QLineEdit::textChanged, this, &MainWindow::onCustomArgsEditFinished);
    connect(ui->laddrEdit, &QLineEdit::textChanged, this, &MainWindow::laddrEditFinished);
    connect(ui->lportEdit, &QLineEdit::textChanged, this, &MainWindow::lportEditFinished);
    connect(ui->methodComboBox, &QComboBox::currentTextChanged, this, &MainWindow::methodChanged);
    connect(ui->pwdEdit, &QLineEdit::textChanged, this, &MainWindow::pwdEditFinished);
    connect(ui->serverEdit, &QLineEdit::textChanged, this, &MainWindow::serverEditFinished);
    connect(ui->sportEdit, &QLineEdit::textChanged, this, &MainWindow::sportEditFinished);
    connect(ui->timeoutSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &MainWindow::timeoutChanged);
#ifdef Q_OS_LINUX
    connect(ui->tfoCheckBox, &QCheckBox::toggled, this, &MainWindow::tcpFastOpenChanged);
#endif
    connect(ui->profileEditButtonBox, &QDialogButtonBox::clicked, this, &MainWindow::profileEditButtonClicked);

    connect(ui->autohideCheck, &QCheckBox::stateChanged, this, &MainWindow::autoHideToggled);
    connect(ui->autostartCheck, &QCheckBox::stateChanged, this, &MainWindow::autoStartToggled);
    connect(ui->debugCheck, &QCheckBox::stateChanged, this, &MainWindow::debugToggled);
    connect(ui->translucentCheck, &QCheckBox::toggled, this, &MainWindow::transculentToggled);
    connect(ui->relativePathCheck, &QCheckBox::toggled, this, &MainWindow::relativePathToggled);
    connect(ui->miscSaveButton, &QPushButton::clicked, this, &MainWindow::saveConfig);
    connect(ui->aboutButton, &QPushButton::clicked, this, &MainWindow::aboutButtonClicked);

    //update current configuration
    ui->profileComboBox->setCurrentIndex(m_conf->getIndex());
    /*
     * If there is no gui-config file, or the index is 0, then the function above wouldn't emit signal.
     * Therefore, we have to emit a signal manually.
     */
    if (m_conf->getIndex() <= 0) {
        emit ui->profileComboBox->currentIndexChanged(m_conf->getIndex());
    }
}