Пример #1
0
int
ISclose(InputStream stream)
{
    MySignalHandler(*prevtrap) ();
    if (stream == NULL || stream->base.close == NULL ||
	stream->base.type & IST_UNCLOSE)
	return -1;
    prevtrap = mySignal(SIGINT, SIG_IGN);
    stream->base.close(stream->base.handle);
    mySignal(SIGINT, prevtrap);
    return 0;
}
Пример #2
0
int Widget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: mySignal(); break;
        case 1: on_toolButton_List_clicked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 2: tableWidget_cellDoubleClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 3: on_toolButton_lrcD_clicked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 4: on_toolButton_next_clicked(); break;
        case 5: on_toolButton_stop_clicked(); break;
        case 6: on_toolButton_playpause_clicked(); break;
        case 7: on_toolButton_previous_clicked(); break;
        case 8: on_toolButton_open_clicked(); break;
        case 9: showTime((*reinterpret_cast< qint64(*)>(_a[1]))); break;
        case 10: Timeout(); break;
        case 11: musicInformationStateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break;
        case 12: mediaObjectStateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break;
        case 13: musicAboutToFinish(); break;
        case 14: currentMusicSourceChanged((*reinterpret_cast< Phonon::MediaSource(*)>(_a[1]))); break;
        case 15: removeSlot(); break;
        case 16: exitSlot(); break;
        case 17: iconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 18;
    }
    return _id;
}
Пример #3
0
MySignalHandler
error_dump(SIGNAL_ARG)
{
    mySignal(SIGIOT, SIG_DFL);
    reset_tty();
    abort();
    SIGNAL_RETURN;
}
Пример #4
0
MessageController::MessageController()
    : QThread()
{
    connect(this,SIGNAL(mySignal()),this,SLOT(setStuff()));
   moveToThread(this);
   srand(time(NULL));

}
Пример #5
0
void
set_int(void)
{
    mySignal(SIGHUP, reset_exit);
    mySignal(SIGINT, reset_exit);
    mySignal(SIGQUIT, reset_exit);
    mySignal(SIGTERM, reset_exit);
    mySignal(SIGILL, error_dump);
    mySignal(SIGIOT, error_dump);
    mySignal(SIGFPE, error_dump);
#ifdef	SIGBUS
    mySignal(SIGBUS, error_dump);
#endif				/* SIGBUS */
    /* mySignal(SIGSEGV, error_dump); */
}
Пример #6
0
int MessageController::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QThread::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: mySignal(); break;
        case 1: setStuff(); break;
        default: ;
        }
        _id -= 2;
    }
    return _id;
}
Пример #7
0
widget::widget(QWidget *parent) :
    QWidget(parent,Qt::FramelessWindowHint),
    ui(new Ui::widget)
{
    ui->setupUi(this);
    setFixedSize(506,364);
    isSound = true;
    ui->hSlider_SongProgress->setRange(0,0);
 //   mList = new musicList(this);
//    mList->setFixedSize(300,320);
  //  mList->ui->tableWidget->setColumnWidth(0,300);
 //   mList->ui->tableWidget->setColumnWidth(1,150);
    ui->tableWidget->setAcceptDrops(true);
    ui->tableWidget->setColumnWidth(0,30);
    ui->tableWidget->setColumnWidth(1,150);


 //   connect(mList->ui->tableWidget,SIGNAL(cellDoubleClicked(int,int)),SLOT(tableWidget_cellDoubleClicked(int,int)));
    connect(ui->tableWidget,SIGNAL(cellDoubleClicked(int,int)),SLOT(tableWidget_cellDoubleClicked(int,int)));
    //  mList->show();
 //   connect(mList,SIGNAL(listClose()),ui->toolButton_List,SLOT(toggle()));
//  connect(ui->toolButton_open,SIGNAL(triggered),this,SLOT(on_toolButton_open_clicked()));
//  connect(ui->toolButton_Sound, SIGNAL(triggered),this,SLOT(on_toolButton_List_clicked()));

    text = new QTextEdit(this);
    text->hide();//用于查找下句歌词以计算时间间隔
    ui->textEdit->setVisible(false);//文本编辑框不可见,(解析歌词)
    this->setAcceptDrops(true);
//    this->setFixedSize(300,150);

    readSettings();//读取上次关闭窗口时窗口的位置

    QPalette palette = ui->label_lrc->palette();//设置窗体内歌词颜色
    palette.setColor(QPalette::WindowText,Qt::darkBlue);
    ui->label_lrc->setPalette(palette);
    lrc = new lrcWindow(0);//桌面歌词

    createPlayMode();
    createOpenFileMenu();
    createContextMenu();
    createSystemTrayIcon();

    volume = 50;

    playList=new QMediaPlaylist;
    playList->setPlaybackMode(QMediaPlaylist::Loop);
    player=new QMediaPlayer;
    player->setPlaylist(playList);
    player->setVolume(volume);



    ui->hSlider_Volume->setValue(volume);
    connect(ui->hSlider_SongProgress, SIGNAL(sliderMoved(int)), this, SLOT(setPosition(int)));
    connect(ui->hSlider_Volume, SIGNAL(sliderMoved(int)), this, SLOT(setSound(int)));

    connect(ui->action_SingleLoopMode, SIGNAL(triggered()), this, SLOT(setSingleLoopMode()));
    connect(ui->action_SequentialMode, SIGNAL(triggered()), this, SLOT(setSequentialMode()));
    connect(ui->action_LoopMode, SIGNAL(triggered()), this, SLOT(setLoopMode()));
    connect(ui->action_RandomMode, SIGNAL(triggered()), this, SLOT(setRandomMode()));
    connect(ui->action_About, SIGNAL(triggered()), this, SLOT(aboutUs()));
    connect(ui->action_Quit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->action_AddFiles,SIGNAL(triggered()), this, SLOT(setAddFiles()));
    connect(ui->action_AddFileFolder, SIGNAL(triggered()), this, SLOT(setAddFileFolder()));

    connect(ui->toolButton_close,SIGNAL(clicked()),this, SLOT(close()));
    connect(ui->toolButton_min,SIGNAL(clicked()),this,SLOT(showMinimized()));

    connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
    connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
    connect(playList, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSongList(int)));
// connect(player,SIGNAL(tick(qint64)),this,SLOT(showTime(qint64)));//时间显示与歌词的更新

    timer = new QTimer(this);//定时器,若0.1秒不显示歌词,则显示“Music ...”
    timer->start(100);
    lrcID = startTimer(100);
    connect(timer,SIGNAL(timeout()),SLOT(Timeout()));

//    iconpause = new QIcon(":/images/btn_plause0.png");
//    iconplay = new QIcon(":/images/btn_play0.png");

//    ui->toolButton_playpause->setIcon(*iconplay);
    ui->toolButton_playpause->setToolTip(tr("播放"));

    ui->toolButton_playpause->setStyleSheet("QToolButton{border-image:url(:/images/btn_play0.png);}"
                                            "QToolButton:hover{border-image:url(:/images/btn_play1.png);}");
    ui->toolButton_stop->setStyleSheet("QToolButton{border-image:url(:/images/btn_stop0.png);}"
                                       "QToolButton:hover{border-image:url(:/images/btn_stop1.png);}");
    ui->toolButton_previous->setStyleSheet("QToolButton{border-image:url(:/images/btn_pre0.png);}"
                                           "QToolButton:hover{border-image:url(:/images/btn_pre1.png);}");
    ui->toolButton_next->setStyleSheet("QToolButton{border-image:url(:/images/btn_next0.png);}"
                                       "QToolButton:hover{border-image:url(:/images/btn_next1.png);}");
    ui->toolButton_open->setStyleSheet("QToolButton{border-image:url(:/images/btn_openFile0.png);}"
                                       "QToolButton:hover{border-image:url(:/images/btn_openFile1.png);}");
    ui->toolButton_Sound->setStyleSheet("QToolButton{border-image:url(:/images/btn_sound0.png);}"
                                       "QToolButton:hover{border-image:url(:/images/btn_sound1.png);}");
    ui->toolButton_playMode->setStyleSheet("QToolButton{border-image:url(:/images/seqtional.PNG);}"
                                           "QToolButton:hover{border-image:url(:/images/seqtional1.png);}");
    ui->toolButton_close->setStyleSheet("QToolButton:hover{border-image:url(:/images/close.png);}");
    ui->toolButton_min->setStyleSheet("QToolButton:hover{border-image:url(:/images/min.png);}");
    ui->toolButton_mintray->setStyleSheet("QToolButton:hover{border-image:url(:/images/mintray.png);}");
    ui->toolButton_toolstyle->setStyleSheet("QToolButton:hover{border-image:url(:/images/toolstyle.png);}");
    ui->toolButton_main->setStyleSheet("QToolButton:hover{border-image:url(:/images/main.png);}");
    ui->toolButton_showfront->setStyleSheet("QToolButton:hover{border-image:url(:/images/showfront.png);}");
    ui->toolButton_p->setStyleSheet("QToolButton:hover{border-image:url(:/images/putup.png);}");
    ui->toolButton_s->setStyleSheet("QToolButton:hover{border-image:url(:/images/spin.png);}");

    ui->toolButton_lrcD->setStyleSheet("QToolButton:hover{background:rgb(0,255,255,100)}");
    ui->label_Title->setStyleSheet("QLabel:hover{color: rgb(85, 255, 255);}");
    QPalette p = this->palette();
    p.setColor(QPalette::WindowText,QColor(0,255,255));
    ui->label_palyname->setPalette(p);
    p.setColor(QPalette::WindowText,QColor(255,190,0));
    ui->label_lrc->setPalette(p);

  //  mList->installEventFilter(this);
  //  mList->ui->tableWidget->installEventFilter(this);//事件过滤器
    ui->tableWidget->installEventFilter(this);
//    connect(audioOutput,SIGNAL(mutedChanged(bool)),sound,SLOT(setChecked(bool)));
    connect(this,SIGNAL(mySignal()),this,SLOT(close()),Qt::QueuedConnection);

    init(playList);
//    mList->show();
 //   addToPlayList();
}
Пример #8
0
void MyClass2::DoSomething()
{
    emit mySignal();
}
int main()
{
    Prueba pr0;

    mtk::Signal<> mySignal;

    std::cout << std::endl << "una conexión a uno     Tres conexiones a 2, mandamos un signal" << std::endl;
    mySignal.connect(&pr0, &Prueba::Recibio);
    mySignal.connect(&pr0, &Prueba::Recibio2);
    mySignal.connect(&pr0, &Prueba::Recibio2);
    mySignal.connect(&pr0, &Prueba::Recibio2);
    mySignal.emit();




    std::cout << std::endl << "Desconectamos un 2" << std::endl;
    bool result = mySignal.disconnect(&pr0, &Prueba::Recibio2);
    if (result)
        std::cout << std::endl << "Desconectamos un 2  OK" << std::endl;
    else
        std::cout << std::endl << "Desconectamos un 2  FAIL" << std::endl;
    mySignal.emit();


    std::cout << std::endl << "Desconectamos un 1" << std::endl;
    result = mySignal.disconnect(&pr0, &Prueba::Recibio);
    if (result)
        std::cout << std::endl << "Desconectamos un 1  OK" << std::endl;
    else
        std::cout << std::endl << "Desconectamos un 1  FAIL" << std::endl;
    mySignal.emit();


    std::cout << std::endl << "Desconectamos un 1" << std::endl;
    result = mySignal.disconnect(&pr0, &Prueba::Recibio);
    if (result)
        std::cout << std::endl << "Desconectamos un 1  OK" << std::endl;
    else
        std::cout << std::endl << "Desconectamos un 1  FAIL" << std::endl;
    mySignal();



    std::cout << std::endl << "desconectamos todo... y mandamos un mensaje nuevo";
    mySignal.disconnect_all();
    mySignal();



    //  pendiente la copia de signal
    //  falta meter el countPtr
//    Signal<> mySignal2;
//    mySignal2 = mySignal;

    //  pendiente que se desconecte cuando el receptor salga de ámbito
    //  delicado
    Prueba pr6(22);
    mySignal.connect(&pr6, &Prueba::Recibio);

    std::cout << std::endl << "Creamos otro recpetor temporal, conectamos a 1 mandamo señal";
    {
        Prueba pr1(23);

        mySignal.connect(&pr1, &Prueba::Recibio);
        mySignal();

    }
    std::cout << std::endl << "el últmo receptor temporal sale de ámbito";
    Prueba pr2(24);
    mySignal.connect(&pr2, &Prueba::Recibio);
    std::cout << std::endl << "acceso incorrecto a la memoria";
    std::cout << std::endl << "Sólo se debería escribir 1";
    mySignal();





    //mtk::Signal<> mySignal;
    //std::cout << std::endl << "Creamos un temporal 777 que sale de ámbito antes de poner mandar nada";

    {
        Prueba pr1(77);

        mySignal.connect(&pr1, &Prueba::Recibio);
        mySignal.connect(&pr1, &Prueba::Recibio);
        mySignal.emit();

    }
    Prueba pr22(88);
    mySignal.connect(&pr22, &Prueba::Recibio);
    mySignal();

    mySignal.disconnect(&pr22, &Prueba::Recibio);
    mySignal();



    Prueba2 prueba2;
    prueba2.Connect();
    prueba2.Signal();


    {
        //  conectamos dos signal al mismo receptor
        //  sacamos de ámbito a dicho receptor
        //  mandamos una signal
        //  tiene que recibirse
        //  esto generaba un error antes del 5 de julio de 2010

        Prueba pr;
        mtk::Signal<>  signalpr1;
        mtk::Signal<>  signalpr2;

        signalpr1.connect(&pr, &Prueba::Recibio);
        signalpr2.connect(&pr, &Prueba::Recibio);
        signalpr1.disconnect(&pr, &Prueba::Recibio);
        std::cout << "SE TIENE QUE RECIBIR..."  << std::endl;
        signalpr2.emit();
    }


    return 0;
}
Пример #10
0
bool MySensorGestureRecognizer::start()
{
    Q_EMIT mySignal();
    return true;
}
Пример #11
0
void MessageController::run()
{
   // QTimer::singleShot(0,this,SLOT(setStuff()));
   emit(mySignal());
}
Пример #12
0
TsignalApp::TsignalApp()
{
	connect( this, SIGNAL( mySignal() ), SLOT( mySlot() ) );
	connect( this, SIGNAL( mySignal( int ), SLOT( mySlot( int ) ) );
	connect( this, SIGNAL( mySignalParam( int, int ), SLOT( mySlotParam( int, int );
}
Пример #13
0
void TsignalApp::slotFileNew()
{
	emit mySignal();
	emit mySignal( 5 );
	emit mySignalParam( 5, 100 );
}