コード例 #1
0
ファイル: systray.cpp プロジェクト: jplsek/puush-qt
Systray::Systray(QObject *parent) : QObject(parent)
{
    s.setEmptyToDefaults();

    createActions();
    createTrayIcon();

    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon,
            SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
            SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    setTrayIcon(":/images/puush-qt.png");

    trayIcon->show();

    trayIcon->setToolTip("puush-qt");

    history = new History();

    connect(history,
            SIGNAL(historyDone(QList<ApiHist::HistData>)), this,
            SLOT(updateHistoryMenu(QList<ApiHist::HistData>)));

    // Get the history after the app starts. For some reason the context
    // menu hangs when getting the history, even though it's asynchronous.
    // So just call it soon (waiting for wifi or something to come up after starting on boot...).
    updateHistoryAfterTimeout();
}
コード例 #2
0
ファイル: main.cpp プロジェクト: clangen/winkill
static void stopHook() {
    hooked = (!winkill_remove_hook());

    if (!hooked) {
        setTrayIcon(iconActive);
    }
}
コード例 #3
0
void MainWindow::slotAudioStateChanged(AudioState newState) {
    setTrayIcon(newState == AudioState::Playing);
    if (newState == AudioState::Stopped) {
        updateUI(nullptr);
        statusBar_.clearMessage();
    }
}
コード例 #4
0
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);


}
コード例 #5
0
ファイル: main.cpp プロジェクト: clangen/winkill
static void startHook() {
    hooked = winkill_install_hook(mainWindow);

    if (hooked) {
        setTrayIcon(iconKilled);
    }
    else {
        MessageBox(mainWindow, L"Couldn't start keyboard hook!", L"WinKill", MB_OK);
    }
}
コード例 #6
0
ファイル: qsystemtray.cpp プロジェクト: alick/mytunet
QSystemTray::QSystemTray(const QPixmap &icon) : QLabel(NULL, "", WMouseNoMask | WRepaintNoErase | WType_TopLevel | WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop)
{

    setMinimumSize(22, 22);
    setBackgroundMode(X11ParentRelative);
    setBackgroundOrigin(WindowOrigin);

    setPixmap(icon);
    setAlignment(AlignHCenter);
    setScaledContents(true);
    setTrayIcon(*this);
}
コード例 #7
0
ファイル: systray.cpp プロジェクト: jplsek/puush-qt
/**
 * Notify the user when the upload to Puush has been completed.
 * @brief Systray::puushDone
 * @param returnCode
 * @param output
 */
void Systray::puushDone(QString output)
{
    setTrayIcon(":/images/puush-qt.png");

    if (output.isEmpty() || !output.contains(",")) {
        trayIcon->showMessage(tr("Error!"), tr("Something went wrong. Wrong URL? No internet connection?"),
                              QSystemTrayIcon::Critical);
        qDebug() << "puushDone error: " << output;
        return;
    }

    QStringList pieces = output.split(",");
    QString code = pieces[0];
    QString url = "";

    if (pieces.length() > 1)
        url = pieces[1];

    QSystemTrayIcon::MessageIcon warningIcon = QSystemTrayIcon::Warning;
    QSystemTrayIcon::MessageIcon infoIcon = QSystemTrayIcon::Information;

    // code can only be 0 = success, or these errors.
    if (code == "-1") {
        trayIcon->showMessage(tr("Error!"), tr("Uploading failed. Have you authenticated?"), warningIcon);
        return;
    } else if (code == "-2") {
        trayIcon->showMessage(tr("Error!"), tr("Uploading failed. This might be a bug with puush-qt."),
                              warningIcon);
        return;
    } else if (code == "-3") {
        trayIcon->showMessage(tr("Error!"), tr("Uploading failed due invalid md5."), warningIcon);
        return;
    }

    lastUrl = QUrl(url);
    history->setDirty();

    if (s.value(Settings::ON_PUUSH_COPY_LINK_TO_CLIPBOARD).toBool()) {
        QApplication::clipboard()->setText(url);
        trayIcon->showMessage(tr("Success!"), url + tr("\nThe url was copied to your clipboard!"),
                              infoIcon);
    } else {
        trayIcon->showMessage(tr("Success!"), url, infoIcon);
    }

    if (s.value(Settings::ON_PUUSH_OPEN_LINK_IN_BROWSER).toBool()) {
        openUrl(url);
    }

    updateHistoryAfterTimeout();
}
コード例 #8
0
void MainDialog::NowRun()
{
	centerWidget(this);
	this->show();

	obj_this = this;

	ui.setupUi(this);
	QIcon accountIcon(QLatin1String(":rc/user.png"));
	QListWidgetItem *account = new QListWidgetItem(accountIcon, "Account", ui.labelWidget);
	account->setSizeHint(QSize(0, 32));
	this->accountSettings = new AccountSettings(this);
	ui.stack->addWidget(this->accountSettings);

	QIcon syslogIcon(QLatin1String(":rc/loop_alt4.png"));
	QListWidgetItem *syslog = new QListWidgetItem(syslogIcon, "Log Activity", ui.labelWidget);
	syslog->setSizeHint(QSize(0, 32));
	this->logSettings = new LogSettings;
	ui.stack->addWidget(this->logSettings);

	QIcon generalIcon(QLatin1String(":rc/cog.png"));
	QListWidgetItem *general = new QListWidgetItem(generalIcon, "General", ui.labelWidget);
	general->setSizeHint(QSize(0, 32));
	this->generalSettings = new GeneralSettings(this);
	ui.stack->addWidget(this->generalSettings);

	ui.labelWidget->setCurrentRow(ui.labelWidget->row(account));

	connect(ui.labelWidget, SIGNAL(currentRowChanged(int)),
		ui.stack, SLOT(setCurrentIndex(int)));

	connect(this->ui.exitButton, SIGNAL(clicked()), this, SLOT(slotExit()));

	createTrayIcon();
	setTrayIcon();
	trayIcon->show();	
	
	agent_cfg = (struct agent_cfg*)calloc(1, sizeof(struct agent_cfg));
	agent_cfg->ev.on_log = this->onLog;

	if (agent_config_init(agent_cfg)) {
		jlog(L_ERROR, "agent_config_init failed");
		return;
	}

	if (agent_cfg->auto_connect != 0) {
		emit this->generalSettings->slotCheckAutoConnect();
		emit accountSettings->slotConnWaiting();
		emit this->slotFireConnection();
	}
}
コード例 #9
0
ファイル: vctrl.cpp プロジェクト: rbbrnc/Junkyard
Vctrl::Vctrl()
{
	if (::mixer_open() < 0) {
		qCritical() << "Cannot open mixer device";
	}

	int volume = ::mixer_get_volume();

	setWindowFlags(Qt::Popup);

	QVBoxLayout *layout = new QVBoxLayout(this);
	m_label = new QLabel(QString::number(volume), this);

	m_slider = new QSlider(Qt::Vertical, this);
    m_slider->setRange(0, 100);
    m_slider->setSingleStep(5);
    m_slider->setPageStep(10);
	m_slider->setValue(volume);
    m_slider->resize(SLIDER_WIDTH, SLIDER_HEIGHT);

	layout->addWidget(m_label);
	layout->addWidget(m_slider);

	connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));

	// Create Actions
	quitAction = new QAction(QIcon(":/cancel.png"), tr("&Quit"), this);
	connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

	// Create Tray Icon
	trayIconMenu = new QMenu(this);
	trayIconMenu->addAction(quitAction);
	trayIconMenu->addSeparator();

	trayIcon = new QSystemTrayIcon(this);
	trayIcon->setContextMenu(trayIconMenu);

	setTrayIcon(volume);
	trayIcon->setVisible(true);

	connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
		this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

	trayIcon->show();

    resize(SLIDER_WIDTH, SLIDER_HEIGHT);
}
コード例 #10
0
void MainWindow::settingsPressed()
{
    if (!setsdlg)
    {
        setsdlg = new SettingsDialog(this);
        setsdlg->setModal(true);
    }
    setsdlg->putSettings();
    if (setsdlg->exec()==QDialog::Accepted)
    {
        setsdlg->getSettings();
        writeSettings();
        setConsoleHidden(settings.hideconsole);
        setTrayIcon(settings.trayicon);
        ui->actionSound->setChecked(settings.soundsenabled);
        checkTextSettings();
    }
}
コード例 #11
0
ファイル: vctrl.cpp プロジェクト: rbbrnc/Junkyard
void Vctrl::onSliderValueChanged(int volume)
{
	(void) mixer_set_volume(volume);
	m_label->setText(QString::number(volume));
	setTrayIcon(volume);
}
コード例 #12
0
ファイル: systray.cpp プロジェクト: jplsek/puush-qt
/**
 * Notify the user when a Puush upload has started.
 * @brief Systray::puushStarted
 */
void Systray::puushStarted()
{
    setTrayIcon(":/images/puush-qt-uploading.png");
}
コード例 #13
0
MainWindow::MainWindow(AudioPlayer &player, QWidget *parent)
    : QMainWindow(parent),
      statusBar_(this),
      player_(player),
      cursorFollowsPlayback_(false),
      saveTabs_(false) {
    setupUi(this);
    // Not saving a pointer to this
    QActionGroup *playbackOrderGroup = new QActionGroup(this);
    playbackOrderGroup->addAction(defaultAction);
    playbackOrderGroup->addAction(randomAction);
    playbackOrderGroup->addAction(repeatTrackAction);
    playbackOrderGroup->addAction(repeatPlaylistAction);
    installEventFilter(this);

    player.setMainWindow(this);

    QObject::connect(&player_, SIGNAL(playbackOrderChanged(PlaybackOrder)), this,
                     SLOT(playbackOrderChanged(PlaybackOrder)));
    QObject::connect(&player_, SIGNAL(audioStateChanged(AudioState)), this,
                     SLOT(slotAudioStateChanged(AudioState)));
    QObject::connect(&player_, SIGNAL(trackPlaying(PTrack)), this, SLOT(updateUI(PTrack)));
    playbackOrderChanged(player.playbackOrder());

    QObject::connect(&player_, SIGNAL(tick(qint64)), this, SLOT(tick(qint64)));
    seekSlider_ = new SeekSlider(player_, this);
    volumeSlider_ = new QSlider(this);
    volumeSlider_->setOrientation(Qt::Horizontal);
    volumeSlider_->setMaximum(100);
    volumeSlider_->setMinimum(0);
    volumeSlider_->setValue(player_.volume() * 100);
    volumeSlider_->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    QObject::connect(volumeSlider_, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
    mainToolBar->addWidget(seekSlider_);
    mainToolBar->addWidget(volumeSlider_);

    trayIcon_ = new QSystemTrayIcon(this);
    setTrayIcon(false);
    connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
            SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
    trayIcon_->show();

    setStatusBar(&statusBar_);
    QObject::connect(&statusBar_, SIGNAL(statusBarDoubleClicked()), this,
                     SLOT(statusBarDoubleClicked()));

    lyricsDock_ = new QDockWidget("Lyrics", this);
    // Not setting an object name because we don't want save its state
    // since Qt doesn't restore it correctly
    //     lyricsDock_->setObjectName("LyricsDock");
    lyricsWidget_ = new QPlainTextEdit(lyricsDock_);
    //     lyricsWidget_->setObjectName("LyricsWidget");
    lyricsWidget_->setReadOnly(true);
    lyricsDock_->setWidget(lyricsWidget_);
    QObject::connect(lyricsDock_, SIGNAL(visibilityChanged(bool)), this,
                     SLOT(dockVisibilityChanged(bool)));

    //     playlistTabs->setTabsClosable(true);
    QObject::connect(playlistTabs, SIGNAL(tabCloseRequested(int)), this,
                     SLOT(removePlaylistTab(int)));
    QObject::connect(playlistTabs, SIGNAL(newTabRequested()), this, SLOT(newTabRequested()));

    QObject::connect(menu_File, SIGNAL(aboutToShow()), this, SLOT(menuFileAboutToShow()));

    setWindowIcon(QIcon(":/icon/logo22.png"));

    instance = this;

    console_ = new ConsoleWindow(this);
    QObject::connect(console_, SIGNAL(visibilityChanged(bool)), this,
                     SLOT(consoleVisibilityChanged(bool)));

    readSettings();

    config_.set("mainwindow.save_tabs", QVariant(saveTabs_));
    QObject::connect(&config_, SIGNAL(keySet(QString, QVariant)), this,
                     SLOT(configChanged(QString, QVariant)));

    setShortcuts();
}
コード例 #14
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    readSettings();
    ui->actionSound->setChecked(settings.soundsenabled);

    irc = new QIrc();
    if (!irc->createSession())
    {
        QMessageBox::critical(this, tr("Error"), tr("Can't create session"));
        close();
        return;
    }
    connect(irc, SIGNAL(sigConnected()), this, SLOT(sltConnected()));
    connect(irc, SIGNAL(sigMessage(QString,QString)), this, SLOT(sltMessage(QString,QString)));
    connect(irc, SIGNAL(sigChannelJoined(QString,QString)), this, SLOT(sltChannelJoined(QString,QString)));
    connect(irc, SIGNAL(sigChannelParted(QString,QString,QString)), this, SLOT(sltChannelParted(QString,QString,QString)));
    connect(irc, SIGNAL(sigChannelNames(QString,QString,QStringList)), this, SLOT(sltChannelNames(QString,QString,QStringList)));
    connect(irc, SIGNAL(sigChannelMessage(QString,QString,QString)), this, SLOT(sltChannelMessage(QString,QString,QString)));
    connect(irc, SIGNAL(sigPrivateMessage(QString,QString,QString)), this, SLOT(sltPrivateMessage(QString,QString,QString)));
    connect(irc, SIGNAL(sigNick(QString,QString)), this, SLOT(sltNick(QString,QString)));
    connect(irc, SIGNAL(sigNotice(QString,QString,QString)), this, SLOT(sltNotice(QString,QString,QString)));
    connect(irc, SIGNAL(sigTopic(QString,QString,QString)), this, SLOT(sltTopic(QString,QString,QString)));
    connect(irc, SIGNAL(sigTopicSet(QString,QString,QString,QString)), this, SLOT(sltTopicSet(QString,QString,QString,QString)));
    connect(irc, SIGNAL(sigKick(QString,QString,QString)), this, SLOT(sltKick(QString,QString,QString)));
    connect(irc, SIGNAL(sigQuit(QString,QString)), this, SLOT(sltQuit(QString,QString)));
    connect(irc, SIGNAL(sigChannelModeChanged(QString,QString,QStringList)), this, SLOT(sltChannelModeChanged(QString,QString,QStringList)));
    connect(irc, SIGNAL(sigUmode(QString,QString)), this, SLOT(sltUmode(QString,QString)));
    connect(irc, SIGNAL(sigInvite(QString,QString,QString)), this, SLOT(sltInvite(QString,QString,QString)));
    connect(irc, SIGNAL(sigCtcpAction(QString,QString,QString)), this, SLOT(sltCtcpAction(QString,QString,QString)));
    connect(irc, SIGNAL(sigErrorOccured(QString)), this, SLOT(sltErrorOccured(QString)));

    consolebrowser = new QTextEdit();
    consolebrowser->setReadOnly(true);
    QFont consolefont;
    if (consolefont.fromString(settings.consolefont))
        consolebrowser->setFont(consolefont);

    if (!settings.hideconsole)
        consoleindex =ui->tabWidget->insertTab(0, consolebrowser, tr("Console"));

    setsdlg = 0;

    usercontextmenu = new QMenu(this);
    usercontextmenu->addAction(ui->actionPrivateChat);
    usercontextmenu->addAction(ui->actionInsert_to_editor);
    QMenu *managementmenu = usercontextmenu->addMenu(tr("Management"));
    managementmenu->addAction(ui->actionKick);
    managementmenu->addAction(ui->actionBan);
    managementmenu->addAction(ui->actionKickBan);
    managementmenu->addSeparator();
    managementmenu->addAction(ui->actionOp);
    managementmenu->addAction(ui->actionDeOp);
    managementmenu->addSeparator();
    managementmenu->addAction(ui->actionVoice);
    managementmenu->addAction(ui->actiondeVoice);
    connect(ui->treeWidget, SIGNAL(userContextMenu(QPoint)), this, SLOT(userContextMenuRequested(QPoint)));

    channelcontextmenu = new QMenu(this);
    channelcontextmenu->addAction(ui->actionLeave_channel);
    channelcontextmenu->addAction(ui->actionChannel_settings);
    connect(ui->treeWidget, SIGNAL(channelContextMenu(QPoint)), this, SLOT(channelContextMenuRequested(QPoint)));

    channelsettingsdialog = 0;
    trayicon = 0;
    traymenu = 0;
    setTrayIcon(settings.trayicon);
    connect(ui->actionChannel_settings, SIGNAL(triggered()), this, SLOT(channelSettingsPressed()));

    //smile menu
    smilemenu = new QMenu(this);
    smilewidgetaction = new QWidgetAction(smilemenu);
    smilebar = new SmileBar();
    smilewidgetaction->setDefaultWidget(smilebar);
    smilemenu->addAction(smilewidgetaction);
    connect(smilebar, SIGNAL(smileClicked(QString)), ui->plainTextEditMessage, SLOT(insertPlainText(QString)));
    connect(smilebar, SIGNAL(smileClicked(QString)), ui->plainTextEditMessage, SLOT(setFocus()));
    ui->actionEmoticons->setMenu(smilemenu);
    smilebutton = new QToolButton();
    smilebutton->setDefaultAction(ui->actionEmoticons);
    smilebutton->setPopupMode(QToolButton::InstantPopup);
    ui->mainToolBar->addWidget(smilebutton);

    channellistdialog = new ChannelListDialog();
    connect(irc, SIGNAL(sigChannelListStart()), channellistdialog, SLOT(showAndClear()));
    connect(irc, SIGNAL(sigChannelListAddItem(QString,QString,QString)), channellistdialog,
            SLOT(addListItem(QString,QString,QString)));
    connect(irc, SIGNAL(sigChannelListEnd()), channellistdialog, SLOT(endOfList()));
    connect(channellistdialog, SIGNAL(channelDoubleClicked(QString)), irc, SLOT(joinChannel(QString)));

    connect(ui->pushButtonSend, SIGNAL(clicked()), ui->plainTextEditMessage, SIGNAL(sendKeyPressed()));
    connect(ui->plainTextEditMessage, SIGNAL(sendKeyPressed()), this, SLOT(sendPressed()));
    connect(ui->actionConnect, SIGNAL(triggered()), this, SLOT(connectPressed()));
    connect(ui->actionDisconnect, SIGNAL(triggered()), this, SLOT(disconnectPressed()));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(settingsPressed()));
    connect(ui->actionJoin, SIGNAL(triggered()), this, SLOT(joinPressed()));
    connect(ui->treeWidget, SIGNAL(userDoubleClicked(QString)), this, SLOT(userDoubleClicked(QString)));
    connect(ui->actionPrivateChat, SIGNAL(triggered()), this, SLOT(privateChatPressed()));
    connect(ui->actionLeave_channel, SIGNAL(triggered()), this, SLOT(leaveChannelPressed()));
    connect(ui->actionKick, SIGNAL(triggered()), this, SLOT(kickPressed()));
    connect(ui->actionBan, SIGNAL(triggered()), this, SLOT(BanPressed()));
    connect(ui->actionKickBan, SIGNAL(triggered()), this, SLOT(kickBanPressed()));
    connect(ui->actionOp, SIGNAL(triggered()), this, SLOT(opPressed()));
    connect(ui->actionDeOp, SIGNAL(triggered()), this, SLOT(deOpPressed()));
    connect(ui->actionVoice, SIGNAL(triggered()), this, SLOT(voicePressed()));
    connect(ui->actiondeVoice, SIGNAL(triggered()), this, SLOT(devoicePressed()));
    connect(ui->pushButtonNick, SIGNAL(clicked()), this, SLOT(nickButtonPressed()));
    connect(ui->actionList_of_channels, SIGNAL(triggered()), irc, SLOT(getChannelsList()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
    connect(ui->actionInsert_to_editor, SIGNAL(triggered()), this, SLOT(insertUserToEditorPressed()));
    connect(ui->actionShowHide, SIGNAL(triggered()), this, SLOT(trayIconActivated()));
    connect(ui->actionQuit_program, SIGNAL(triggered()), this, SLOT(quitProgram()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutPressed()));
    connect(ui->actionSound, SIGNAL(toggled(bool)), this, SLOT(soundActionToogled(bool)));
}