author | zecke <zecke> | 2004-03-28 20:39:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-28 20:39:22 (UTC) |
commit | b4c5da4a6cf51753e8d2da505197326e05323d73 (patch) (unidiff) | |
tree | 6b9814683e717f8445496dc0d4c8d23eda223dc3 /libopie2/opieui/okeyconfigwidget.cpp | |
parent | 4cbd5ad37e51b7bc9c749f8eda2e46a806d904b0 (diff) | |
download | opie-b4c5da4a6cf51753e8d2da505197326e05323d73.zip opie-b4c5da4a6cf51753e8d2da505197326e05323d73.tar.gz opie-b4c5da4a6cf51753e8d2da505197326e05323d73.tar.bz2 |
From yesterday. Some sort of GUI loading
Diffstat (limited to 'libopie2/opieui/okeyconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/okeyconfigwidget.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.cpp b/libopie2/opieui/okeyconfigwidget.cpp index 2ea0bd5..273f15b 100644 --- a/libopie2/opieui/okeyconfigwidget.cpp +++ b/libopie2/opieui/okeyconfigwidget.cpp | |||
@@ -535,13 +535,12 @@ OKeyConfigItem OKeyConfigManager::handleKeyEvent( QKeyEvent* e ) { | |||
535 | int mod = e->state(); | 535 | int mod = e->state(); |
536 | 536 | ||
537 | /* | 537 | /* |
538 | * virtual keyboard | 538 | * virtual keyboard |
539 | * else change the button mod only | 539 | * else change the button mod only |
540 | */ | 540 | */ |
541 | qWarning( "handleKeyEvent...." ); | ||
542 | if ( key == 0 ) { | 541 | if ( key == 0 ) { |
543 | key = e->ascii(); | 542 | key = e->ascii(); |
544 | if ( key > 96 && key < 123) | 543 | if ( key > 96 && key < 123) |
545 | key -= 32; | 544 | key -= 32; |
546 | }else{ | 545 | }else{ |
547 | int new_mod = 0; | 546 | int new_mod = 0; |
@@ -604,12 +603,18 @@ void OKeyConfigManager::removeKeyConfig( const OKeyConfigItem& item ) { | |||
604 | */ | 603 | */ |
605 | void OKeyConfigManager::clearKeyConfig() { | 604 | void OKeyConfigManager::clearKeyConfig() { |
606 | m_keys.clear(); | 605 | m_keys.clear(); |
607 | delete m_map; m_map = 0; | 606 | delete m_map; m_map = 0; |
608 | } | 607 | } |
609 | 608 | ||
609 | /** | ||
610 | * | ||
611 | */ | ||
612 | Opie::Ui::OKeyConfigItem::List OKeyConfigManager::keyConfigList()const{ | ||
613 | return m_keys; | ||
614 | } | ||
610 | 615 | ||
611 | /** | 616 | /** |
612 | * Add this OKeyPair to the blackList. | 617 | * Add this OKeyPair to the blackList. |
613 | * Internal lists will be destroyed | 618 | * Internal lists will be destroyed |
614 | */ | 619 | */ |
615 | void OKeyConfigManager::addToBlackList( const OKeyPair& key) { | 620 | void OKeyConfigManager::addToBlackList( const OKeyPair& key) { |
@@ -750,17 +755,17 @@ namespace Private { | |||
750 | return m_item; | 755 | return m_item; |
751 | } | 756 | } |
752 | OKeyConfigManager* OKeyListViewItem::manager() { | 757 | OKeyConfigManager* OKeyListViewItem::manager() { |
753 | return m_manager; | 758 | return m_manager; |
754 | } | 759 | } |
755 | void OKeyListViewItem::setItem( const OKeyConfigItem& item ) { | 760 | void OKeyListViewItem::setItem( const OKeyConfigItem& item ) { |
761 | m_item = item; | ||
756 | setPixmap( 0, m_item.pixmap() ); | 762 | setPixmap( 0, m_item.pixmap() ); |
757 | setText ( 1, m_item.text() ); | 763 | setText ( 1, m_item.text() ); |
758 | setText ( 2, keyToString( m_item.keyPair() ) ); | 764 | setText ( 2, keyToString( m_item.keyPair() ) ); |
759 | setText ( 3, keyToString( m_item.defaultKeyPair() ) ); | 765 | setText ( 3, keyToString( m_item.defaultKeyPair() ) ); |
760 | m_item = item; | ||
761 | } | 766 | } |
762 | 767 | ||
763 | QString keyToString( const OKeyPair& pair ) { | 768 | QString keyToString( const OKeyPair& pair ) { |
764 | int mod = 0; | 769 | int mod = 0; |
765 | if ( pair.modifier() & Qt::ShiftButton ) | 770 | if ( pair.modifier() & Qt::ShiftButton ) |
766 | mod |= Qt::SHIFT; | 771 | mod |= Qt::SHIFT; |
@@ -850,13 +855,12 @@ void OKeyConfigWidget::initUi() { | |||
850 | 855 | ||
851 | /* | 856 | /* |
852 | * GROUP with button info | 857 | * GROUP with button info |
853 | */ | 858 | */ |
854 | 859 | ||
855 | QGroupBox *box = new QGroupBox( this ); | 860 | QGroupBox *box = new QGroupBox( this ); |
856 | box ->setEnabled( false ); | ||
857 | box ->setTitle( tr("Shortcut for Selected Action") ); | 861 | box ->setTitle( tr("Shortcut for Selected Action") ); |
858 | box ->setFrameStyle( QFrame::Box | QFrame::Sunken ); | 862 | box ->setFrameStyle( QFrame::Box | QFrame::Sunken ); |
859 | layout->addWidget( box, 1 ); | 863 | layout->addWidget( box, 1 ); |
860 | 864 | ||
861 | gridLay = new QGridLayout( box, 3, 4 ); | 865 | gridLay = new QGridLayout( box, 3, 4 ); |
862 | gridLay->addRowSpacing( 0, fontMetrics().lineSpacing() ); | 866 | gridLay->addRowSpacing( 0, fontMetrics().lineSpacing() ); |
@@ -926,13 +930,20 @@ void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) { | |||
926 | 930 | ||
927 | 931 | ||
928 | /** | 932 | /** |
929 | * loads the items and allows editing them | 933 | * loads the items and allows editing them |
930 | */ | 934 | */ |
931 | void OKeyConfigWidget::load() { | 935 | void OKeyConfigWidget::load() { |
936 | Opie::Ui::Private::OKeyConfigWidgetPrivateList::Iterator it; | ||
937 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | ||
938 | OListViewItem *item = new OListViewItem( m_view, (*it).name ); | ||
939 | OKeyConfigItem::List list = (*it).manager->keyConfigList(); | ||
940 | for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt ) | ||
941 | (void )new Opie::Ui::Private::OKeyListViewItem(*keyIt, (*it).manager, item ); | ||
932 | 942 | ||
943 | } | ||
933 | } | 944 | } |
934 | 945 | ||
935 | /** | 946 | /** |
936 | * Saves if in Queue Mode. It'll update the supplied | 947 | * Saves if in Queue Mode. It'll update the supplied |
937 | * OKeyConfigManager objects. | 948 | * OKeyConfigManager objects. |
938 | * If in Queue mode it'll just return | 949 | * If in Queue mode it'll just return |
@@ -968,12 +979,13 @@ void OKeyConfigWidget::slotListViewItem( QListViewItem* _item) { | |||
968 | m_def ->setChecked( false ); | 979 | m_def ->setChecked( false ); |
969 | } | 980 | } |
970 | } | 981 | } |
971 | } | 982 | } |
972 | 983 | ||
973 | void OKeyConfigWidget::slotNoKey() { | 984 | void OKeyConfigWidget::slotNoKey() { |
985 | qWarning( "No Key" ); | ||
974 | m_none->setChecked( true ); | 986 | m_none->setChecked( true ); |
975 | m_cus ->setChecked( false ); | 987 | m_cus ->setChecked( false ); |
976 | m_btn ->setEnabled( false ); | 988 | m_btn ->setEnabled( false ); |
977 | m_def ->setChecked( false ); | 989 | m_def ->setChecked( false ); |
978 | 990 | ||
979 | if ( !m_view->currentItem() || m_view->currentItem()->parent() ) | 991 | if ( !m_view->currentItem() || m_view->currentItem()->parent() ) |
@@ -992,12 +1004,13 @@ void OKeyConfigWidget::slotNoKey() { | |||
992 | if ( m_mode == Imediate ) | 1004 | if ( m_mode == Imediate ) |
993 | item->manager()->addKeyConfig( item->item() ); | 1005 | item->manager()->addKeyConfig( item->item() ); |
994 | 1006 | ||
995 | } | 1007 | } |
996 | 1008 | ||
997 | void OKeyConfigWidget::slotDefaultKey() { | 1009 | void OKeyConfigWidget::slotDefaultKey() { |
1010 | qWarning( "Slot Default Key" ); | ||
998 | m_none->setChecked( true ); | 1011 | m_none->setChecked( true ); |
999 | m_cus ->setChecked( false ); | 1012 | m_cus ->setChecked( false ); |
1000 | m_btn ->setEnabled( false ); | 1013 | m_btn ->setEnabled( false ); |
1001 | m_def ->setChecked( false ); | 1014 | m_def ->setChecked( false ); |
1002 | 1015 | ||
1003 | if ( !m_view->currentItem() || m_view->currentItem()->parent() ) | 1016 | if ( !m_view->currentItem() || m_view->currentItem()->parent() ) |
@@ -1015,12 +1028,13 @@ void OKeyConfigWidget::slotDefaultKey() { | |||
1015 | 1028 | ||
1016 | if ( m_mode == Imediate ) | 1029 | if ( m_mode == Imediate ) |
1017 | item->manager()->addKeyConfig( item->item() ); | 1030 | item->manager()->addKeyConfig( item->item() ); |
1018 | } | 1031 | } |
1019 | 1032 | ||
1020 | void OKeyConfigWidget::slotCustomKey() { | 1033 | void OKeyConfigWidget::slotCustomKey() { |
1034 | qWarning( "SlotCustom Key" ); | ||
1021 | m_cus ->setChecked( true ); | 1035 | m_cus ->setChecked( true ); |
1022 | m_btn ->setEnabled( true ); | 1036 | m_btn ->setEnabled( true ); |
1023 | m_def ->setChecked( false ); | 1037 | m_def ->setChecked( false ); |
1024 | m_none->setChecked( false ); | 1038 | m_none->setChecked( false ); |
1025 | 1039 | ||
1026 | if ( !m_view->currentItem() || m_view->currentItem()->parent() ) | 1040 | if ( !m_view->currentItem() || m_view->currentItem()->parent() ) |