void UtilitiesView::handleCall(int ID, int from, int status, QString num){
    Member m;
    int i=0;
    qDebug()<<"UTILITIES_VIEW: Handling call "<<ID<<" "<<status<<"  "<<num;
    while(i<teamMembers.count() && teamMembers.at(i).number.compare(num)!=0){
        i++;
    }

    if(i<teamMembers.count()){
        m = teamMembers.value(i);
        m.status = (CallStatus)status;
        if(m.status == CALL_DISCONNECT){
            m.callID = -1;
        }else{
            m.callID = ID;
        }
        teamMembers.replace(i,m);
        ui->teamList->item(i)->setIcon(getStatusIcon(m.status));
    }

    if(from && status == CALL_ACTIVE){
        QMessageBox *msg = new QMessageBox(this);
        msg->setStandardButtons(QMessageBox::Ok);
        msg->setAttribute(Qt::WA_DeleteOnClose);
        msg->setIcon(QMessageBox::Information);
        msg->setWindowModality(Qt::NonModal);
        msg->setWindowTitle("Informazione");
        msg->setModal(false);

        QSqlQuery q(MainWindow::database);
        q.prepare("SELECT Cognome, Nome FROM Team WHERE Tel = :num");
        q.bindValue(":num", num);
        q.exec();

        if(q.next()){
            msg->setText(QString("Chiamata in arrivo da %1 %2")
                         .arg(q.value(0).toString()).arg(q.value(1).toString()));
        }else{
            msg->setText("Chiamata in arrivo da numero sconosciuto");
        }
        msg->exec();
    }
}
Ejemplo n.º 2
0
void QMainWindowTray::setTrayIcon(bool online, int unread)
{
    trayIcon->setIcon(*getStatusIcon(online, unread));
}
Ejemplo n.º 3
0
void Widget::init()
{
    ui->setupUi(this);

    timer = new QTimer();
    timer->start(1000);
    offlineMsgTimer = new QTimer();
    offlineMsgTimer->start(15000);

    //restore window state
    restoreGeometry(Settings::getInstance().getWindowGeometry());
    restoreState(Settings::getInstance().getWindowState());
    ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());

    statusOnline = new QAction(tr("Online", "Button to set your status to 'Online'"), this);
    statusOnline->setIcon(getStatusIcon(Status::Online, 10, 10));
    connect(statusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
    statusAway = new QAction(tr("Away", "Button to set your status to 'Away'"), this);
    statusAway->setIcon(getStatusIcon(Status::Away, 10, 10));
    connect(statusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
    statusBusy = new QAction(tr("Busy", "Button to set your status to 'Busy'"), this);
    statusBusy->setIcon(getStatusIcon(Status::Busy, 10, 10));
    connect(statusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy()));

    ui->statusbar->hide();
    ui->menubar->hide();

    layout()->setContentsMargins(0, 0, 0, 0);
    ui->friendList->setStyleSheet(Style::resolve(Style::getStylesheet(":ui/friendList/friendList.css")));

    profilePicture = new MaskablePixmapWidget(this, QSize(40, 40), ":/img/avatar_mask.svg");
    profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg"));
    profilePicture->setClickable(true);
    ui->myProfile->insertWidget(0, profilePicture);
    ui->myProfile->insertSpacing(1, 7);

    ui->mainContent->setLayout(new QVBoxLayout());
    ui->mainHead->setLayout(new QVBoxLayout());
    ui->mainHead->layout()->setMargin(0);
    ui->mainHead->layout()->setSpacing(0);

    ui->tooliconsZone->setStyleSheet(Style::resolve("QPushButton{background-color:@themeDark;border:none;}QPushButton:hover{background-color:@themeMediumDark;border:none;}"));
    
    if (QStyleFactory::keys().contains(Settings::getInstance().getStyle())
            && Settings::getInstance().getStyle() != "None")
    {
        ui->mainHead->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
        ui->mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
    }
    
    ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css"));    
    ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css"));
    
    ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));

    contactListWidget = new FriendListWidget(0, Settings::getInstance().getGroupchatPosition());
    ui->friendList->setWidget(contactListWidget);
    ui->friendList->setLayoutDirection(Qt::RightToLeft);

    ui->statusLabel->setEditable(true);

    ui->statusPanel->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));

    QMenu *statusButtonMenu = new QMenu(ui->statusButton);
    statusButtonMenu->addAction(statusOnline);
    statusButtonMenu->addAction(statusAway);
    statusButtonMenu->addAction(statusBusy);
    ui->statusButton->setMenu(statusButtonMenu);

    // disable proportional scaling
    ui->mainSplitter->setStretchFactor(0,0);
    ui->mainSplitter->setStretchFactor(1,1);

    onStatusSet(Status::Offline);

    // Disable some widgets until we're connected to the DHT
    ui->statusButton->setEnabled(false);

    Style::setThemeColor(Settings::getInstance().getThemeColor());
    reloadTheme();
    updateIcons();

    filesForm = new FilesForm();
    addFriendForm = new AddFriendForm;
    profileForm = new ProfileForm();
    settingsWidget = new SettingsWidget();

    Core* core = Nexus::getCore();
    connect(core, SIGNAL(fileDownloadFinished(const QString&)), filesForm, SLOT(onFileDownloadComplete(const QString&)));
    connect(core, SIGNAL(fileUploadFinished(const QString&)), filesForm, SLOT(onFileUploadComplete(const QString&)));
    connect(settingsWidget, &SettingsWidget::setShowSystemTray, this, &Widget::onSetShowSystemTray);
    connect(core, SIGNAL(selfAvatarChanged(QPixmap)), profileForm, SLOT(onSelfAvatarLoaded(QPixmap)));
    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked()));
    connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
    connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
    connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
    connect(profilePicture, &MaskablePixmapWidget::clicked, this, &Widget::showProfile);
    connect(ui->nameLabel, &CroppingLabel::clicked, this, &Widget::showProfile);
    connect(ui->statusLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onStatusMessageChanged(QString, QString)));
    connect(ui->mainSplitter, &QSplitter::splitterMoved, this, &Widget::onSplitterMoved);
    connect(addFriendForm, SIGNAL(friendRequested(QString, QString)), this, SIGNAL(friendRequested(QString, QString)));
    connect(timer, &QTimer::timeout, this, &Widget::onUserAwayCheck);
    connect(timer, &QTimer::timeout, this, &Widget::onEventIconTick);
    connect(timer, &QTimer::timeout, this, &Widget::onTryCreateTrayIcon);
    connect(offlineMsgTimer, &QTimer::timeout, this, &Widget::processOfflineMsgs);

    addFriendForm->show(*ui);

    connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, contactListWidget, &FriendListWidget::onGroupchatPositionChanged);
#if (AUTOUPDATE_ENABLED)
    if (Settings::getInstance().getCheckUpdates())
        AutoUpdater::checkUpdatesAsyncInteractive();
#endif
    if (!Settings::getInstance().getShowSystemTray())
        show();
}
Ejemplo n.º 4
0
void Widget::onStatusSet(Status status)
{
    ui->statusButton->setProperty("status", getStatusTitle(status));
    ui->statusButton->setIcon(getStatusIcon(status, 10, 10));
    updateIcons();
}