summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c6d9cfd..ca90427 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -544,120 +544,136 @@ private:
544 544
545static int& hack(int& i) 545static int& hack(int& i)
546{ 546{
547#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 547#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
548 // These should be created, but aren't in Qt 2.3.0 548 // These should be created, but aren't in Qt 2.3.0
549 (void)new QUtf8Codec; 549 (void)new QUtf8Codec;
550 (void)new QUtf16Codec; 550 (void)new QUtf16Codec;
551#endif 551#endif
552 return i; 552 return i;
553} 553}
554 554
555static int muted = 0; 555static int muted = 0;
556static int micMuted = 0; 556static int micMuted = 0;
557 557
558static void setVolume( int t = 0, int percent = -1 ) 558static void setVolume( int t = 0, int percent = -1 )
559{ 559{
560 switch ( t ) { 560 switch ( t ) {
561 case 0: { 561 case 0: {
562 Config cfg( "qpe" ); 562 Config cfg( "qpe" );
563 cfg.setGroup( "Volume" ); 563 cfg.setGroup( "Volume" );
564 if ( percent < 0 ) 564 if ( percent < 0 )
565 percent = cfg.readNumEntry( "VolumePercent", 50 ); 565 percent = cfg.readNumEntry( "VolumePercent", 50 );
566#ifndef QT_NO_SOUND 566#ifndef QT_NO_SOUND
567 int fd = 0; 567 int fd = 0;
568#ifdef QT_QWS_DEVFS
569 if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) {
570#else
568 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 571 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
572#endif
569 int vol = muted ? 0 : percent; 573 int vol = muted ? 0 : percent;
570 // set both channels to same volume 574 // set both channels to same volume
571 vol |= vol << 8; 575 vol |= vol << 8;
572 ioctl( fd, MIXER_WRITE( SOUND_MIXER_VOLUME ), &vol ); 576 ioctl( fd, MIXER_WRITE( SOUND_MIXER_VOLUME ), &vol );
573 ::close( fd ); 577 ::close( fd );
574 } 578 }
575#endif 579#endif
576 } 580 }
577 break; 581 break;
578 } 582 }
579} 583}
580 584
581static void setMic( int t = 0, int percent = -1 ) 585static void setMic( int t = 0, int percent = -1 )
582{ 586{
583 switch ( t ) { 587 switch ( t ) {
584 case 0: { 588 case 0: {
585 Config cfg( "qpe" ); 589 Config cfg( "qpe" );
586 cfg.setGroup( "Volume" ); 590 cfg.setGroup( "Volume" );
587 if ( percent < 0 ) 591 if ( percent < 0 )
588 percent = cfg.readNumEntry( "Mic", 50 ); 592 percent = cfg.readNumEntry( "Mic", 50 );
589 593
590#ifndef QT_NO_SOUND 594#ifndef QT_NO_SOUND
591 int fd = 0; 595 int fd = 0;
592 int mic = micMuted ? 0 : percent; 596 int mic = micMuted ? 0 : percent;
597#ifdef QT_QWS_DEVFS
598 if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) {
599#else
593 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 600 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
601#endif
594 ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); 602 ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic );
595 ::close( fd ); 603 ::close( fd );
596 } 604 }
597#endif 605#endif
598 } 606 }
599 break; 607 break;
600 } 608 }
601} 609}
602 610
603 611
604static void setBass( int t = 0, int percent = -1 ) 612static void setBass( int t = 0, int percent = -1 )
605{ 613{
606 switch ( t ) { 614 switch ( t ) {
607 case 0: { 615 case 0: {
608 Config cfg( "qpe" ); 616 Config cfg( "qpe" );
609 cfg.setGroup( "Volume" ); 617 cfg.setGroup( "Volume" );
610 if ( percent < 0 ) 618 if ( percent < 0 )
611 percent = cfg.readNumEntry( "BassPercent", 50 ); 619 percent = cfg.readNumEntry( "BassPercent", 50 );
612 620
613#ifndef QT_NO_SOUND 621#ifndef QT_NO_SOUND
614 int fd = 0; 622 int fd = 0;
615 int bass = percent; 623 int bass = percent;
624#ifdef QT_QWS_DEVFS
625 if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) {
626#else
616 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 627 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
628#endif
617 ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); 629 ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass );
618 ::close( fd ); 630 ::close( fd );
619 } 631 }
620#endif 632#endif
621 } 633 }
622 break; 634 break;
623 } 635 }
624} 636}
625 637
626 638
627static void setTreble( int t = 0, int percent = -1 ) 639static void setTreble( int t = 0, int percent = -1 )
628{ 640{
629 switch ( t ) { 641 switch ( t ) {
630 case 0: { 642 case 0: {
631 Config cfg( "qpe" ); 643 Config cfg( "qpe" );
632 cfg.setGroup( "Volume" ); 644 cfg.setGroup( "Volume" );
633 if ( percent < 0 ) 645 if ( percent < 0 )
634 percent = cfg.readNumEntry( "TreblePercent", 50 ); 646 percent = cfg.readNumEntry( "TreblePercent", 50 );
635 647
636#ifndef QT_NO_SOUND 648#ifndef QT_NO_SOUND
637 int fd = 0; 649 int fd = 0;
638 int treble = percent; 650 int treble = percent;
651#ifdef QT_QWS_DEVFS
652 if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) {
653#else
639 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 654 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
655#endif
640 ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); 656 ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble );
641 ::close( fd ); 657 ::close( fd );
642 } 658 }
643#endif 659#endif
644 } 660 }
645 break; 661 break;
646 } 662 }
647} 663}
648 664
649 665
650/** 666/**
651 \class QPEApplication 667 \class QPEApplication
652 \brief The QPEApplication class implements various system services 668 \brief The QPEApplication class implements various system services
653 that are available to all Qtopia applications. 669 that are available to all Qtopia applications.
654 670
655 Simply by using QPEApplication instead of QApplication, a standard Qt 671 Simply by using QPEApplication instead of QApplication, a standard Qt
656 application becomes a Qtopia application. It automatically follows 672 application becomes a Qtopia application. It automatically follows
657 style changes, quits and raises, and in the 673 style changes, quits and raises, and in the
658 case of \link docwidget.html document-oriented\endlink applications, 674 case of \link docwidget.html document-oriented\endlink applications,
659 changes the currently displayed document in response to the environment. 675 changes the currently displayed document in response to the environment.
660 676
661 To create a \link docwidget.html document-oriented\endlink 677 To create a \link docwidget.html document-oriented\endlink
662 application use showMainDocumentWidget(); to create a 678 application use showMainDocumentWidget(); to create a
663 non-document-oriented application use showMainWidget(). The 679 non-document-oriented application use showMainWidget(). The