preferences: Remove CPUFrequency
We can't reliably set contemporary processors to an arbitrary frequency. There are dependencies between cores and thechnologies like Turbo Boost which may make actual frequency significantly different than the requested. Moreover, it is the scheduler job to decide how much CPU performance is needed and user shouldn't interfere with that.
This commit is contained in:
parent
99a2e56579
commit
208f76e578
@ -53,7 +53,7 @@ SYSTEM_APPS = [ FFilterByBuildFeatures
|
||||
StyledEdit Terminal TextSearch TV WebWatch Workspaces
|
||||
] ;
|
||||
SYSTEM_PREFERENCES = [ FFilterByBuildFeatures
|
||||
Appearance Backgrounds CPUFrequency DataTranslations
|
||||
Appearance Backgrounds DataTranslations
|
||||
<preference>Deskbar E-mail FileTypes Keyboard Keymap Locale Media
|
||||
Mouse Network Notifications Printers Screen ScreenSaver
|
||||
Shortcuts Sounds Time Touchpad <preference>Tracker VirtualMemory
|
||||
|
@ -53,7 +53,7 @@ SYSTEM_APPS = [ FFilterByBuildFeatures
|
||||
StyledEdit Terminal TextSearch Workspaces
|
||||
] ;
|
||||
SYSTEM_PREFERENCES = [ FFilterByBuildFeatures
|
||||
Appearance Backgrounds CPUFrequency
|
||||
Appearance Backgrounds
|
||||
<preference>Deskbar FileTypes Keyboard Keymap Locale
|
||||
Mouse Network Notifications Screen ScreenSaver
|
||||
Shortcuts Time Touchpad <preference>Tracker VirtualMemory
|
||||
|
@ -1,21 +0,0 @@
|
||||
1 belarusian x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view Так
|
||||
CPU frequency status view CPU Frequency View Паказнік стану частаты працэсара
|
||||
OK Status view ОК
|
||||
Set state Status view Пазначыць стан
|
||||
Defaults Pref Window Прадвызначаныя
|
||||
Install replicant into Deskbar CPU Frequency View Усталяваць рэплікант у Deskbar
|
||||
Quit Status view Выйсце
|
||||
High performance Status view Вышэйшая прадукцыйнасць
|
||||
Stepping policy CPU Frequency View Палітыка пакрокавай рэгуляцыі
|
||||
Dynamic performance Status view Дынамічная прадукцыйнасць
|
||||
Step up by CPU usage Color Step View Актывізаваць у залежнасьці ад занятасці працэсара
|
||||
Dynamic stepping CPU Frequency View Дынамічны рэжым пакрокавай рэгуляцыі
|
||||
Stepping policy: CPU Frequency View Палітыка пакрокавай рэгуляцыі:
|
||||
Integration time [ms]: CPU Frequency View Квант інтэграцыі [ms]:
|
||||
Open Speedstep preferences… Status view Паказаць наладкі Speedstep…
|
||||
Revert Pref Window Вярнуць
|
||||
Low energy Status view Экономия энергии
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Немагчыма запусціць канфігурацыйную праграму!\n\nКод памылкі:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPU Frequency\n\tбыў распрацаваны Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Частата Працэсара
|
@ -1,18 +0,0 @@
|
||||
1 bulgarian x-vnd.Haiku-CPUFrequencyPref 1018039204
|
||||
Ok Status view Ок
|
||||
CPU frequency status view CPU Frequency View Статус на CPU честотата
|
||||
Set state Status view Изберете състояние
|
||||
Defaults Pref Window По подразбиране
|
||||
Install replicant into Deskbar CPU Frequency View Инсталирай репликант в Deskbar
|
||||
High performance Status view Висока производителност
|
||||
Stepping policy CPU Frequency View Постъпково изменение на частотата на CPU
|
||||
Dynamic performance Status view Динамична производителност
|
||||
Step up by CPU usage Color Step View Стъпка на производителност на CPU:
|
||||
Dynamic stepping CPU Frequency View Динамично изменение
|
||||
Stepping policy: CPU Frequency View Постъпково изменение на частотата на CPU:
|
||||
Integration time [ms]: CPU Frequency View Време на интеграция [мс]:
|
||||
Open Speedstep preferences… Status view Отвори постъпковите настройки
|
||||
Revert Pref Window Върни
|
||||
Low energy Status view Икономия на енергия
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Старта на CPU Frequency не се състоя.\n\nГрешка:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPUFrequency\n\tе разработен от Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
@ -1,19 +0,0 @@
|
||||
1 czech x-vnd.Haiku-CPUFrequencyPref 3974849433
|
||||
CPU frequency status view CPU Frequency View Zobrazení statusu frekvence CPU
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPUFrequency\n\tnapsal Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
Defaults Pref Window Původní
|
||||
Dynamic performance Status view Dynamický výkon
|
||||
Dynamic stepping CPU Frequency View Dynamické krokování
|
||||
High performance Status view Vysoký výkon
|
||||
Install replicant into Deskbar CPU Frequency View Instaloval replikant do Deskbaru
|
||||
Integration time [ms]: CPU Frequency View Integrační čas [ms]:
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Nepodařilo se otevřít nastavení frekvence CPU.\n\nChyba:
|
||||
Low energy Status view Nízká spotřeba
|
||||
Ok Status view Ok
|
||||
Open Speedstep preferences… Status view Otevřít nastavení SpeedStep...
|
||||
Quit Status view Odejít
|
||||
Revert Pref Window Obnovit
|
||||
Set state Status view Nastavit stav
|
||||
Step up by CPU usage Color Step View Krokovat podle využití CPU
|
||||
Stepping policy CPU Frequency View Krokovací politika
|
||||
Stepping policy: CPU Frequency View Krokovací politika:
|
@ -1,19 +0,0 @@
|
||||
1 danish x-vnd.Haiku-CPUFrequencyPref 3974849433
|
||||
CPU frequency status view CPU Frequency View CPU frekvens statusoversigt
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPUFrekvens\n\tskrevet af Clemens Zeidler\n\tOphavsret 2009, Haiku, Inc.\n
|
||||
Defaults Pref Window Standard indstillinger
|
||||
Dynamic performance Status view Dynamisk ydeevne
|
||||
Dynamic stepping CPU Frequency View Dynamisk acceleration
|
||||
High performance Status view Høj ydeevne
|
||||
Install replicant into Deskbar CPU Frequency View Indsæt replikant i Deskbar
|
||||
Integration time [ms]: CPU Frequency View Integrationstid [ms]:
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Det var ikke muligt at starte CPU frekvens indstillings programmet.\n\nFejl:
|
||||
Low energy Status view Lavt energiforbrug
|
||||
Ok Status view OK
|
||||
Open Speedstep preferences… Status view Åben Speedstep egenskaber…
|
||||
Quit Status view Afslut
|
||||
Revert Pref Window Tilbagestil
|
||||
Set state Status view Sæt tilstand
|
||||
Step up by CPU usage Color Step View Acceleration efter CPU belastning
|
||||
Stepping policy CPU Frequency View Accelerationspolitik
|
||||
Stepping policy: CPU Frequency View Accelerationspolitik:
|
@ -1,21 +0,0 @@
|
||||
1 german x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view OK
|
||||
CPU frequency status view CPU Frequency View CPU-Takt-Anzeige
|
||||
OK Status view OK
|
||||
Set state Status view Fester Takt
|
||||
Defaults Pref Window Standardwerte
|
||||
Install replicant into Deskbar CPU Frequency View Replikant in Deskbar installieren
|
||||
Quit Status view Beenden
|
||||
High performance Status view Hohe Leistung
|
||||
Stepping policy CPU Frequency View Taktungsrichtlinie
|
||||
Dynamic performance Status view Dynamische Leistung
|
||||
Step up by CPU usage Color Step View Taktänderung ab CPU-Auslastung von:
|
||||
Dynamic stepping CPU Frequency View Dynamische Taktung
|
||||
Stepping policy: CPU Frequency View Taktungsrichtlinie:
|
||||
Integration time [ms]: CPU Frequency View Messintervall [ms]:
|
||||
Open Speedstep preferences… Status view Speedstep Einstellungen öffnen…
|
||||
Revert Pref Window Anfangswerte
|
||||
Low energy Status view Geringer Energieverbrauch
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Das CPU-Takt-Preflet konnte nicht gestartet werden.\n\nFehler:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPU-Takt\n\tGeschrieben von Clemens Zeidler.\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name CPU-Takt
|
@ -1,20 +0,0 @@
|
||||
1 greek, modern (1453-) x-vnd.Haiku-CPUFrequencyPref 3079996868
|
||||
Ok Status view Εντάξει
|
||||
CPU frequency status view CPU Frequency View Συχνότητα επεξεργαστή προβολή κατάστασης
|
||||
Set state Status view Ορισμός κατάστασης
|
||||
Defaults Pref Window Προεπιλογές
|
||||
Install replicant into Deskbar CPU Frequency View Εγκατάσταση αντίγραφου στη Μπάρα εργασιών
|
||||
Quit Status view Έξοδος
|
||||
High performance Status view Υψηλή επίδοση
|
||||
Stepping policy CPU Frequency View Πολιτική βηματισμού
|
||||
Dynamic performance Status view Δυναμική επίδοση
|
||||
Step up by CPU usage Color Step View Αύξηση με χρήση της CPU
|
||||
Dynamic stepping CPU Frequency View Δυναμικός βηματισμός
|
||||
Stepping policy: CPU Frequency View Πολιτική βηματισμού:
|
||||
Integration time [ms]: CPU Frequency View Χρόνος ολοκλήρωσης [ms]:
|
||||
Open Speedstep preferences… Status view Άνοιγμα προτιμήσεων Ταχύτητα βήματος
|
||||
Revert Pref Window Επαναφορά
|
||||
Low energy Status view Χαμηλή ενέργεια
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Απέτυχε η εκκίνηση του preflet Συχνότητα επεξεργαστή.\n\nΣφάλμα:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Συχνότητα Επεξεργαστή\n\tγράφτηκε από τον Clemens Zeidler\n\tΠνευματικά δικαιώματα 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Συχνότητα της CPU
|
@ -1,19 +0,0 @@
|
||||
1 esperanto x-vnd.Haiku-CPUFrequencyPref 3974849433
|
||||
CPU frequency status view CPU Frequency View Procesorofteca stato
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Procesorofteco\n\tskribita per Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
Defaults Pref Window Aprioraj
|
||||
Dynamic performance Status view Dinamika rendimento
|
||||
Dynamic stepping CPU Frequency View Dinamika akcelo
|
||||
High performance Status view Plejbona rendimento
|
||||
Install replicant into Deskbar CPU Frequency View Instali la kopianton en la Deskbar-on
|
||||
Integration time [ms]: CPU Frequency View Integralada tempo [ms]:
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Malsukcesis lanĉi la procesorofteca prefileto.\n\nEraro:
|
||||
Low energy Status view Malgranda energio
|
||||
Ok Status view Bone
|
||||
Open Speedstep preferences… Status view Malfermi la Speedstep-ajn agordojn…
|
||||
Quit Status view Eliri
|
||||
Revert Pref Window Malfari
|
||||
Set state Status view Ŝanĝi staton
|
||||
Step up by CPU usage Color Step View Akcelo per procesora uzo:
|
||||
Stepping policy CPU Frequency View Akcela reĝimo
|
||||
Stepping policy: CPU Frequency View Akcela reĝimo:
|
@ -1,21 +0,0 @@
|
||||
1 finnish x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view Valmis
|
||||
CPU frequency status view CPU Frequency View Suoritintaajuuden tilanäkymä
|
||||
OK Status view Valmis
|
||||
Set state Status view Aseta tila
|
||||
Defaults Pref Window Oletukset
|
||||
Install replicant into Deskbar CPU Frequency View Asenna kopio Työpöytäpalkkiin
|
||||
Quit Status view Poistu
|
||||
High performance Status view Korkea suorituskyky
|
||||
Stepping policy CPU Frequency View Muutostapa
|
||||
Dynamic performance Status view Dynaaminen suorituskyky
|
||||
Step up by CPU usage Color Step View Muuta ylöspäin tämän suorittimen käyttömäärän kohdalla:
|
||||
Dynamic stepping CPU Frequency View Dynaaminen muutos
|
||||
Stepping policy: CPU Frequency View Muutostapa:
|
||||
Integration time [ms]: CPU Frequency View Integraatioaika [ms]:
|
||||
Open Speedstep preferences… Status view Avaa nopeusaskelvalinnat...
|
||||
Revert Pref Window Palauta
|
||||
Low energy Status view Matala energiankulutus
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Suoritintaajuuden asetusohjelman käynnistys epäonnistui.\n\nVirhe:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Suoritintaajuusasetukset\n\t tekijä: Clemens Zeidler\n\t Copyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Suoritintaajuusasetukset
|
@ -1,21 +0,0 @@
|
||||
1 french x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view Ok
|
||||
CPU frequency status view CPU Frequency View Vue de l'état de la fréquence du CPU
|
||||
OK Status view OK
|
||||
Set state Status view Changer l'état
|
||||
Defaults Pref Window Par défauts
|
||||
Install replicant into Deskbar CPU Frequency View Installer le réplicant dans la Deskbar
|
||||
Quit Status view Quitter
|
||||
High performance Status view Haute performance
|
||||
Stepping policy CPU Frequency View Stratégie d'accélération
|
||||
Dynamic performance Status view Performance dynamique
|
||||
Step up by CPU usage Color Step View Accélération selon l'activité CPU
|
||||
Dynamic stepping CPU Frequency View Accélération dynamique
|
||||
Stepping policy: CPU Frequency View Stratégie d'accélération :
|
||||
Integration time [ms]: CPU Frequency View Temps d'intégration [ms] :
|
||||
Open Speedstep preferences… Status view Ouvrir les préférences Speestep…
|
||||
Revert Pref Window Rétablir
|
||||
Low energy Status view Basse consommation
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Échec de lancement des préférences de fréquence du CPU.\n\nErreur :
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Fréquence CPU\n\tÉcrit par Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Fréquence CPU
|
@ -1,20 +0,0 @@
|
||||
1 hindi x-vnd.Haiku-CPUFrequencyPref 3079996868
|
||||
Ok Status view ठीक है
|
||||
CPU frequency status view CPU Frequency View सीपियु आवृत्ति स्थिति देखने के लिए
|
||||
Set state Status view सेट स्टेट
|
||||
Defaults Pref Window डिफ़ॉल्ट्स
|
||||
Install replicant into Deskbar CPU Frequency View डेस्कबार में स्थापित रेप्लिका
|
||||
Quit Status view छोड़ना
|
||||
High performance Status view उच्च निष्पादन
|
||||
Stepping policy CPU Frequency View कदम नीति
|
||||
Dynamic performance Status view गतिशील प्रदर्शन
|
||||
Step up by CPU usage Color Step View धीरे-धीरे सीपियु का उपयोग द्वारा चरण होना
|
||||
Dynamic stepping CPU Frequency View गतिशील कदम
|
||||
Stepping policy: CPU Frequency View कदम नीति:
|
||||
Integration time [ms]: CPU Frequency View एकीकरण समय [एमएस]:
|
||||
Open Speedstep preferences… Status view खुला स्पीद्स्तेप वरीयता ...
|
||||
Revert Pref Window पलटें
|
||||
Low energy Status view कम इनरजी
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view लौन्चिंग सीपियु आवृत्ति शुभारंभ विफल.\n\nत्रुटि:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view सीपियु रेक़ुएन्क्य\n\t क्लेमेंस ज़िल्डर द्वारा त्व्रित्तें\n\t कोप्य्रिघ्त 2009, हाइकू, Inc.\n
|
||||
CPUFrequency System name सीपियु की आवृत्ति
|
@ -1,12 +0,0 @@
|
||||
1 croatian x-vnd.Haiku-CPUFrequencyPref 2355894194
|
||||
CPU frequency status view CPU Frequency View Pogled stanja frekvencije procesora
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Frekvencija procesora\n\tnapisao Clemens Zeidler\n\tAutoraska prava 2009, Haiku, Inc.\n
|
||||
Defaults Pref Window Zadano
|
||||
Dynamic performance Status view Dinamične performanse
|
||||
High performance Status view Visoke performanse
|
||||
Integration time [ms]: CPU Frequency View Vrijeme integracije [ms]:
|
||||
Ok Status view U redu
|
||||
Open Speedstep preferences… Status view Otvori Speedstep osobitosti...
|
||||
Quit Status view Isključi
|
||||
Revert Pref Window Preokreni
|
||||
Set state Status view Postavi stanje
|
@ -1,21 +0,0 @@
|
||||
1 hungarian x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view Rendben
|
||||
CPU frequency status view CPU Frequency View Processzor-frekvencia állapota
|
||||
OK Status view Rendben
|
||||
Set state Status view Órajel beállítása
|
||||
Defaults Pref Window Eredeti
|
||||
Install replicant into Deskbar CPU Frequency View Replikáns telepítése az Asztalsávba
|
||||
Quit Status view Kilépés
|
||||
High performance Status view Nagy teljesítmény
|
||||
Stepping policy CPU Frequency View Fokozatszabályozás
|
||||
Dynamic performance Status view Dinamikus teljesítmény
|
||||
Step up by CPU usage Color Step View Kiegyensúlyozott teljesítmény
|
||||
Dynamic stepping CPU Frequency View Szabadon választható fokozatok
|
||||
Stepping policy: CPU Frequency View Fokozatszabályozás:
|
||||
Integration time [ms]: CPU Frequency View Alkalmazkodás ideje [ms]:
|
||||
Open Speedstep preferences… Status view Fokozatszabályozási beállító megnyitása…
|
||||
Revert Pref Window Visszaállít
|
||||
Low energy Status view Alacsony energiafogyasztás
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Nem sikerült a Processzor-frekvencia elindítása.\n\nHiba:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Processzor-frekvencia\n\tÍrta: Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Processzor-frekvencia
|
@ -1,19 +0,0 @@
|
||||
1 italian x-vnd.Haiku-CPUFrequencyPref 3974849433
|
||||
CPU frequency status view CPU Frequency View Stato frequenza della CPU
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Frequenza CPU\n\tscritto da Clemens Zeidler\n\tDiritti d'autore ©2009, Haiku, Inc.\n
|
||||
Defaults Pref Window Predefiniti
|
||||
Dynamic performance Status view Prestazioni dinamiche
|
||||
Dynamic stepping CPU Frequency View Scalabilità dinamica
|
||||
High performance Status view Prestazioni elevate
|
||||
Install replicant into Deskbar CPU Frequency View Installa il replicante nella Deskbar
|
||||
Integration time [ms]: CPU Frequency View Tempo di intervento [ms]:
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Impossibile far partire le preferenze frequenza CPU.\n\nErrore:
|
||||
Low energy Status view Bassi consumi
|
||||
Ok Status view Ok
|
||||
Open Speedstep preferences… Status view Apri preferenze Speedstep…
|
||||
Quit Status view Esci
|
||||
Revert Pref Window Ripristina
|
||||
Set state Status view Imposta stato
|
||||
Step up by CPU usage Color Step View Scala in base all'utilizzo della CPU
|
||||
Stepping policy CPU Frequency View Regole di scalabilità
|
||||
Stepping policy: CPU Frequency View Regola scalabilità:
|
@ -1,21 +0,0 @@
|
||||
1 japanese x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view Ok
|
||||
CPU frequency status view CPU Frequency View CPU 周波数ビュー
|
||||
OK Status view OK
|
||||
Set state Status view 設定
|
||||
Defaults Pref Window デフォルト
|
||||
Install replicant into Deskbar CPU Frequency View レプリカントを Deskbar に表示
|
||||
Quit Status view 終了
|
||||
High performance Status view ハイパフォーマンス
|
||||
Stepping policy CPU Frequency View ステッピングポリシー
|
||||
Dynamic performance Status view ダイナミックパフォーマンス
|
||||
Step up by CPU usage Color Step View CPU 負荷に応じてステップアップ
|
||||
Dynamic stepping CPU Frequency View ダイナミックステッピング
|
||||
Stepping policy: CPU Frequency View ステッピングポリシー
|
||||
Integration time [ms]: CPU Frequency View 積分時間 [ms]:
|
||||
Open Speedstep preferences… Status view Open Speedstep の設定…
|
||||
Revert Pref Window 元に戻す
|
||||
Low energy Status view 省電力モード
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view CPU 周波数の起動に失敗しました。\n\nエラー:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPU 周波数\n\tClemens Zeidler 作\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name CPU 周波数
|
@ -1,19 +0,0 @@
|
||||
1 korean x-vnd.Haiku-CPUFrequencyPref 3974849433
|
||||
CPU frequency status view CPU Frequency View CPU 주파수 상태 보기
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPU주파수\n\tClemens Zeidler 작성\n\t저작권 2009, Haiku, Inc.\n
|
||||
Defaults Pref Window 기본설정
|
||||
Dynamic performance Status view 동적 성능
|
||||
Dynamic stepping CPU Frequency View 동적 스테핑
|
||||
High performance Status view 고성능
|
||||
Install replicant into Deskbar CPU Frequency View 데스크바에 복제품 설치
|
||||
Integration time [ms]: CPU Frequency View 통합 시간 [ms]:
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view CPU 주파수 제어판 불러오기 실패.\n\n에러:
|
||||
Low energy Status view 저전력
|
||||
Ok Status view 확인
|
||||
Open Speedstep preferences… Status view 스피드스텝 설정 열기…
|
||||
Quit Status view 나가기
|
||||
Revert Pref Window 되돌리기
|
||||
Set state Status view 상태 설정
|
||||
Step up by CPU usage Color Step View CPU 사용량에 따라 증가
|
||||
Stepping policy CPU Frequency View 스테핑 정책
|
||||
Stepping policy: CPU Frequency View 스테핑 정책:
|
@ -1,21 +0,0 @@
|
||||
1 lithuanian x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view Gerai
|
||||
CPU frequency status view CPU Frequency View Centrinio procesoriaus dažnio indikatorius
|
||||
OK Status view Gerai
|
||||
Set state Status view Pasirinkta būsena
|
||||
Defaults Pref Window Numatytai
|
||||
Install replicant into Deskbar CPU Frequency View Patalpinti indikatorių pranešimų srityje
|
||||
Quit Status view Baigti darbą
|
||||
High performance Status view Didelis našumas
|
||||
Stepping policy CPU Frequency View Centrinio procesoriaus veiksena
|
||||
Dynamic performance Status view Prisitaikantis našumas
|
||||
Step up by CPU usage Color Step View Našumo keitimo žingsnis
|
||||
Dynamic stepping CPU Frequency View Prisitaikančio našumo derinimas
|
||||
Stepping policy: CPU Frequency View Centrinio procesoriaus veiksena:
|
||||
Integration time [ms]: CPU Frequency View Integravimosi laikas [ms]:
|
||||
Open Speedstep preferences… Status view CP dažnio nuostatos…
|
||||
Revert Pref Window Atšaukti pakeitimus
|
||||
Low energy Status view Energijos taupymas
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Nepavyko atverti Centrinio procesoriaus dažnio nuostatų lango.\n\nKlaida:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Centrinio procesoriaus dažnis\n\tsukurtas Clemens'o Zeidler'io\n\t© 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Centrinio procesoriaus dažnis
|
@ -1,19 +0,0 @@
|
||||
1 bokmål, norwegian; norwegian bokmål x-vnd.Haiku-CPUFrequencyPref 1579805342
|
||||
Ok Status view OK
|
||||
CPU frequency status view CPU Frequency View Visning av CPU-status
|
||||
Set state Status view Sett tilstand
|
||||
Defaults Pref Window Standardinnstillinger
|
||||
Install replicant into Deskbar CPU Frequency View Installer replikanten i Deskbar
|
||||
Quit Status view Avslutt
|
||||
High performance Status view Høy ytelse
|
||||
Stepping policy CPU Frequency View Stepping-policy
|
||||
Dynamic performance Status view Dynamisk ytelse
|
||||
Dynamic stepping CPU Frequency View Dynamisk stepping
|
||||
Stepping policy: CPU Frequency View Stepping-policy
|
||||
Integration time [ms]: CPU Frequency View Integrasjonstid [ms]:
|
||||
Open Speedstep preferences… Status view Åpne Speedstep-innstillinger
|
||||
Revert Pref Window Tilbakestill
|
||||
Low energy Status view Lavenergi
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Feil ved lasting av Prosessorhastighet. \n\nFeil:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPUFrequency\n\tskrevet av Clemens Zeidler\n\tOpphavsrett 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Prosessorhastighet
|
@ -1,21 +0,0 @@
|
||||
1 dutch; flemish x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view Oké
|
||||
CPU frequency status view CPU Frequency View Weergave CPU-frequentiestatus
|
||||
OK Status view Ok
|
||||
Set state Status view Toestand instellen
|
||||
Defaults Pref Window Standaardwaarden
|
||||
Install replicant into Deskbar CPU Frequency View Replicant in Deskbar installeren
|
||||
Quit Status view Afsluiten
|
||||
High performance Status view Hoge prestaties
|
||||
Stepping policy CPU Frequency View Stapbeleid
|
||||
Dynamic performance Status view Dynamische prestaties
|
||||
Step up by CPU usage Color Step View Opvoeren door CPU-gebruik
|
||||
Dynamic stepping CPU Frequency View Dynamisch opvoeren
|
||||
Stepping policy: CPU Frequency View Opvoerbeleid:
|
||||
Integration time [ms]: CPU Frequency View Integratietijd [ms]:
|
||||
Open Speedstep preferences… Status view Speedstep-voorkeuren openen…
|
||||
Revert Pref Window Herstellen
|
||||
Low energy Status view Lage energie
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Starten van de CPU-frequentiepreflet is mislukt.\n\nFout:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPUFrequency\n\tdoor Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name CPUFrequency
|
@ -1,21 +0,0 @@
|
||||
1 polish x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view Ok
|
||||
CPU frequency status view CPU Frequency View Widok statusu częstotliwości taktowania procesora
|
||||
OK Status view OK
|
||||
Set state Status view Ustaw stan
|
||||
Defaults Pref Window Przywróć ustawienia domyślne
|
||||
Install replicant into Deskbar CPU Frequency View Zainstaluj replikant na Panelu Pulpitu
|
||||
Quit Status view Zamknij
|
||||
High performance Status view Wysoka wydajność
|
||||
Stepping policy CPU Frequency View Polityka skalowania procesora
|
||||
Dynamic performance Status view Dynamicznie dopasowana wydajność
|
||||
Step up by CPU usage Color Step View Ustawiaj taktowanie w zależności od obciążenia procesora
|
||||
Dynamic stepping CPU Frequency View Dynamiczne skalowanie
|
||||
Stepping policy: CPU Frequency View Polityka skalowania:
|
||||
Integration time [ms]: CPU Frequency View Czas integracji (w milisekundach):
|
||||
Open Speedstep preferences… Status view Otwórz ustawienia Speedstep…
|
||||
Revert Pref Window Przywróć poprzednie ustawienia
|
||||
Low energy Status view Oszczędna
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Uruchomienie prefletu częstotliwości procesora zakończyło się niepowodzeniem.\n\nBłąd:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPUFrequency\n\tnapisane przez Clemensa Zeidlera\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Częstotliwość procesora
|
@ -1,12 +0,0 @@
|
||||
1 portuguese x-vnd.Haiku-CPUFrequencyPref 2133997991
|
||||
Defaults Pref Window Predefenições
|
||||
Dynamic stepping CPU Frequency View Aceleração Dinâmica
|
||||
Install replicant into Deskbar CPU Frequency View Instalar o Replicant na Deskbar
|
||||
Integration time [ms]: CPU Frequency View Tempo de integração [ms]:
|
||||
Ok Status view OK
|
||||
Quit Status view Sair
|
||||
Revert Pref Window Reverter
|
||||
Set state Status view Defenir estado
|
||||
Step up by CPU usage Color Step View Variação de velocidade com base no uso do CPU
|
||||
Stepping policy CPU Frequency View Política de Aceleração
|
||||
Stepping policy: CPU Frequency View Política de Aceleração:
|
@ -1,21 +0,0 @@
|
||||
1 portuguese (brazil) x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view Ok
|
||||
CPU frequency status view CPU Frequency View Status da frequência do CPU
|
||||
OK Status view OK
|
||||
Set state Status view Definir estado
|
||||
Defaults Pref Window Padrões
|
||||
Install replicant into Deskbar CPU Frequency View Instalar o replicante na Mesa de Trabalho
|
||||
Quit Status view Sair
|
||||
High performance Status view Alto desempenho
|
||||
Stepping policy CPU Frequency View Política de stepping
|
||||
Dynamic performance Status view Desempenho dinâmico
|
||||
Step up by CPU usage Color Step View Aumentar desempenho por uso de CPU
|
||||
Dynamic stepping CPU Frequency View Stepping dinâmico
|
||||
Stepping policy: CPU Frequency View Política de stepping:
|
||||
Integration time [ms]: CPU Frequency View Tempo de integração [ms]:
|
||||
Open Speedstep preferences… Status view Preferências de Open Speedstep…
|
||||
Revert Pref Window Reverter
|
||||
Low energy Status view Baixa energia
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Não foi possível abrir a Frequência de CPU.\n\nErro:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view A Frequência do CPU\n\tfoi escrito por Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Frequência do CPU
|
@ -1,8 +0,0 @@
|
||||
1 brazilian_portuguese x-vnd.Haiku-CPUFrequencyPref 1149286520
|
||||
CPU frequency status view CPU Frequency View Status da frequência do CPU
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view A Frequência do CPU\n\tfoi escrito por Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
Defaults Pref Window Padrões
|
||||
Install replicant into Deskbar CPU Frequency View Instalar o replicante na Mesa de Trabalho
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Não foi possível abrir a Frequência de CPU.\n\nErro:
|
||||
Low energy Status view Baixa energia
|
||||
Set state Status view Definir estado
|
@ -1,20 +0,0 @@
|
||||
1 romanian x-vnd.Haiku-CPUFrequencyPref 3079996868
|
||||
Ok Status view Ok
|
||||
CPU frequency status view CPU Frequency View Vizualizare a stării frecvenței CPU
|
||||
Set state Status view Stabilește stare
|
||||
Defaults Pref Window Implicite
|
||||
Install replicant into Deskbar CPU Frequency View Instalează copie pe Deskbar
|
||||
Quit Status view Părăsește
|
||||
High performance Status view Performanță înaltă
|
||||
Stepping policy CPU Frequency View Regulă de accelerare
|
||||
Dynamic performance Status view Performanță dinamică
|
||||
Step up by CPU usage Color Step View Accelerare după utilizarea CPU
|
||||
Dynamic stepping CPU Frequency View Accelerare dinamică
|
||||
Stepping policy: CPU Frequency View Regulă de accelerare:
|
||||
Integration time [ms]: CPU Frequency View Timp de integrare [ms]:
|
||||
Open Speedstep preferences… Status view Deschide preferințe viteză…
|
||||
Revert Pref Window Revenire
|
||||
Low energy Status view Energie scăzută
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Pornirea prefletului frecvență CPU a eșuat.\n\nEroare:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view FrecvențăCPU\n\tscris de Clemens Zeidler\n\tDrept de autor 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name FrecvențăCPU
|
@ -1,21 +0,0 @@
|
||||
1 russian x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view ОК
|
||||
CPU frequency status view CPU Frequency View Просмотр состояния частоты ЦП
|
||||
OK Status view OK
|
||||
Set state Status view Выбрать состояние
|
||||
Defaults Pref Window По умолчанию
|
||||
Install replicant into Deskbar CPU Frequency View Установить репликант в Deskbar
|
||||
Quit Status view Выход
|
||||
High performance Status view Высокая производительность
|
||||
Stepping policy CPU Frequency View Настройка шага изменения частоты ЦП
|
||||
Dynamic performance Status view Динамическая производительность
|
||||
Step up by CPU usage Color Step View Шаг вверх по производительности ЦП:
|
||||
Dynamic stepping CPU Frequency View Динамическое изменение
|
||||
Stepping policy: CPU Frequency View Настройка шага изменения частоты ЦП:
|
||||
Integration time [ms]: CPU Frequency View Время интеграции [мс]:
|
||||
Open Speedstep preferences… Status view Настроить частоту процессора…
|
||||
Revert Pref Window Вернуть
|
||||
Low energy Status view Экономия энергии
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Не удалось запустить настройки частоты ЦП.\n\nОшибка:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPUFrequency\n\tразработал Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Частота процессора
|
@ -1,21 +0,0 @@
|
||||
1 slovak x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view OK
|
||||
CPU frequency status view CPU Frequency View Zobrazenie stavy frekvencie CPU
|
||||
OK Status view OK
|
||||
Set state Status view Nastaviť stav
|
||||
Defaults Pref Window Predvoľby
|
||||
Install replicant into Deskbar CPU Frequency View Nainštalovať replikant do Panelu
|
||||
Quit Status view Ukončiť
|
||||
High performance Status view Vysoký výkon
|
||||
Stepping policy CPU Frequency View Politika krokovania
|
||||
Dynamic performance Status view Dynamický výkon
|
||||
Step up by CPU usage Color Step View Krokovať podľa využitia CPU
|
||||
Dynamic stepping CPU Frequency View Dynamické krokovanie
|
||||
Stepping policy: CPU Frequency View Politika krokovania:
|
||||
Integration time [ms]: CPU Frequency View Čas integrácie [ms]:
|
||||
Open Speedstep preferences… Status view Otvoriť nastavenia Speedstep…
|
||||
Revert Pref Window Vrátiť
|
||||
Low energy Status view Nízky odber
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Spustenie konfiguračného apletu Frekvencia CPU zlyhalo.\n\nChyba:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPUFrequency\n\tnapísal Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Frekvencia CPU
|
@ -1,21 +0,0 @@
|
||||
1 swedish x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view OK
|
||||
CPU frequency status view CPU Frequency View Statusvy för ProcessorFrekvens
|
||||
OK Status view OK
|
||||
Set state Status view Ändra läge
|
||||
Defaults Pref Window Förval
|
||||
Install replicant into Deskbar CPU Frequency View Installera replikant i Deskbar
|
||||
Quit Status view Avsluta
|
||||
High performance Status view Hög prestanda
|
||||
Stepping policy CPU Frequency View Accelerationspolicy
|
||||
Dynamic performance Status view Dynamisk prestanda
|
||||
Step up by CPU usage Color Step View Öka vid CPU-belastning
|
||||
Dynamic stepping CPU Frequency View Dynamisk acceleration
|
||||
Stepping policy: CPU Frequency View Accelerationspolicy:
|
||||
Integration time [ms]: CPU Frequency View Integreringstid
|
||||
Open Speedstep preferences… Status view Öppna inställningar för ProcessorFrekvens…
|
||||
Revert Pref Window Återgå
|
||||
Low energy Status view Lågenergiläge
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Misslyckades med att starta inställningsprogrammet ProcessorFrekvens.\n\nFel:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view ProcessorFrekvens\n\tskriven av Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name ProcessorFrekvens
|
@ -1,20 +0,0 @@
|
||||
1 ukrainian x-vnd.Haiku-CPUFrequencyPref 3079996868
|
||||
Ok Status view Гаразд
|
||||
CPU frequency status view CPU Frequency View Статистика частоти ЦП
|
||||
Set state Status view Встановити стан
|
||||
Defaults Pref Window По замовчуванню
|
||||
Install replicant into Deskbar CPU Frequency View Встановити реплікант в Deskbar
|
||||
Quit Status view Вийти
|
||||
High performance Status view Висока продуктивність
|
||||
Stepping policy CPU Frequency View Настройка кроку зміни частоти ЦП
|
||||
Dynamic performance Status view Динамічна продуктивність
|
||||
Step up by CPU usage Color Step View Крок вгору по продуктивності ЦП:
|
||||
Dynamic stepping CPU Frequency View Динамічна зміна
|
||||
Stepping policy: CPU Frequency View Настройка кроку зміни частоти ЦП:
|
||||
Integration time [ms]: CPU Frequency View Час інтеграції [мс]:
|
||||
Open Speedstep preferences… Status view Відкриття покрокової настройки
|
||||
Revert Pref Window Повернути
|
||||
Low energy Status view Мале споживання
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view Програму Частота процесора не вдалося запустити.\n\nПомилка:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Частота процесора\n\Автор Клеменс Зейдлер\n\tCopyright 2009, Haiku, Inc.\n
|
||||
CPUFrequency System name Частота процесора
|
@ -1,20 +0,0 @@
|
||||
1 english x-vnd.Haiku-CPUFrequencyPref 3079996868
|
||||
Ok Status view 确定
|
||||
CPU frequency status view CPU Frequency View CPU 状态视图
|
||||
Set state Status view 状态设置
|
||||
Defaults Pref Window 默认
|
||||
Install replicant into Deskbar CPU Frequency View 添加 CPU 监视器到桌面栏
|
||||
Quit Status view 退出
|
||||
High performance Status view 高性能
|
||||
Stepping policy CPU Frequency View 步进策略
|
||||
Dynamic performance Status view 动态性能
|
||||
Step up by CPU usage Color Step View CPU 步进设置
|
||||
Dynamic stepping CPU Frequency View 动态步进
|
||||
Stepping policy: CPU Frequency View 步进策略:
|
||||
Integration time [ms]: CPU Frequency View 采样时间 [ms]:
|
||||
Open Speedstep preferences… Status view 打开省电设置…
|
||||
Revert Pref Window 取消
|
||||
Low energy Status view 低能耗
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view 启动 CPU 状态通知失败。\n\n错误信息:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPU 监视器\n\t编写者:Clemens Zeidler\n\tCopyright 2009,Haiku .Inc。\n
|
||||
CPUFrequency System name CPU 监视器
|
@ -1,21 +0,0 @@
|
||||
1 english x-vnd.Haiku-CPUFrequencyPref 1007318924
|
||||
Ok Status view 确定
|
||||
CPU frequency status view CPU Frequency View CPU 状态视图
|
||||
OK Status view 确定
|
||||
Set state Status view 状态设置
|
||||
Defaults Pref Window 默认
|
||||
Install replicant into Deskbar CPU Frequency View 添加 CPU 监视器到桌面栏
|
||||
Quit Status view 退出
|
||||
High performance Status view 高性能
|
||||
Stepping policy CPU Frequency View 步进策略
|
||||
Dynamic performance Status view 动态性能
|
||||
Step up by CPU usage Color Step View CPU 步进设置
|
||||
Dynamic stepping CPU Frequency View 动态步进
|
||||
Stepping policy: CPU Frequency View 步进策略:
|
||||
Integration time [ms]: CPU Frequency View 采样时间 [ms]:
|
||||
Open Speedstep preferences… Status view 打开省电设置…
|
||||
Revert Pref Window 取消
|
||||
Low energy Status view 低能耗
|
||||
Launching the CPU frequency preflet failed.\n\nError: Status view 启动 CPU 状态通知失败。\n\n错误信息:
|
||||
CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view CPU 监视器\n\t编写者:Clemens Zeidler\n\tCopyright 2009,Haiku .Inc。\n
|
||||
CPUFrequency System name CPU 监视器
|
@ -3,7 +3,6 @@ SubDir HAIKU_TOP src preferences ;
|
||||
SubInclude HAIKU_TOP src preferences appearance ;
|
||||
SubInclude HAIKU_TOP src preferences backgrounds ;
|
||||
SubInclude HAIKU_TOP src preferences bluetooth ;
|
||||
SubInclude HAIKU_TOP src preferences cpufrequency ;
|
||||
SubInclude HAIKU_TOP src preferences datatranslations ;
|
||||
SubInclude HAIKU_TOP src preferences deskbar ;
|
||||
#SubInclude HAIKU_TOP src preferences dun ;
|
||||
|
@ -1,252 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
|
||||
#include "CPUFrequencyView.h"
|
||||
|
||||
#include "StatusView.h"
|
||||
|
||||
#include <Box.h>
|
||||
#include <Catalog.h>
|
||||
#include <Deskbar.h>
|
||||
#include <GroupView.h>
|
||||
#include <Locale.h>
|
||||
#include <MenuField.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "CPU Frequency View"
|
||||
|
||||
|
||||
const char* kCPUFreqPreferencesFile = "CPUFrequency";
|
||||
const char* kPrefSignature = "application/x-vnd.Haiku-CPUFrequencyPref";
|
||||
const char* kPreferencesFileName = "CPUFrequency";
|
||||
|
||||
const uint32 kInstallIntoDeskbar = '&iid';
|
||||
const uint32 kIntegrationTimeChanged = '&itc';
|
||||
|
||||
const bigtime_t kMilliSecond = 1000;
|
||||
|
||||
|
||||
CPUFrequencyView::CPUFrequencyView(BRect frame,
|
||||
PreferencesStorage<freq_preferences>* storage)
|
||||
:
|
||||
BView(frame, "CPUFrequencyView", B_FOLLOW_NONE, B_WILL_DRAW),
|
||||
fStorage(storage)
|
||||
{
|
||||
BGroupLayout* mainLayout = new BGroupLayout(B_VERTICAL);
|
||||
SetLayout(mainLayout);
|
||||
mainLayout->SetSpacing(10);
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
// stepping policy
|
||||
BRect rect = Bounds();
|
||||
rect.InsetBy(5, 5);
|
||||
BBox *policyBox = new BBox(rect, "policyBox");
|
||||
policyBox->SetLabel(B_TRANSLATE("Stepping policy"));
|
||||
BGroupLayout* policyLayout = new BGroupLayout(B_VERTICAL);
|
||||
policyLayout->SetInsets(10, policyBox->TopBorderOffset() * 2 + 10, 10, 10);
|
||||
policyLayout->SetSpacing(10);
|
||||
policyBox->SetLayout(policyLayout);
|
||||
mainLayout->AddView(policyBox);
|
||||
|
||||
fPolicyMenu = new BMenu(B_TRANSLATE("Stepping policy: "));
|
||||
BMenuField *menuField = new BMenuField("", fPolicyMenu);
|
||||
policyLayout->AddView(menuField);
|
||||
|
||||
// dynamic stepping
|
||||
BBox *dynamicBox = new BBox(rect, "dynamicBox");
|
||||
dynamicBox->SetLabel(B_TRANSLATE("Dynamic stepping"));
|
||||
BGroupLayout* dynamicLayout = new BGroupLayout(B_VERTICAL);
|
||||
dynamicLayout->SetInsets(B_USE_DEFAULT_SPACING,
|
||||
dynamicBox->TopBorderOffset() * 2 + 10,
|
||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
|
||||
dynamicLayout->SetSpacing(B_USE_DEFAULT_SPACING);
|
||||
dynamicBox->SetLayout(dynamicLayout);
|
||||
mainLayout->AddView(dynamicBox);
|
||||
|
||||
fColorStepView = new ColorStepView(frame);
|
||||
fColorStepView->SetFrequencys(fDriverInterface.GetCpuFrequencyStates());
|
||||
|
||||
fIntegrationTime = new BTextControl(BRect(0, 0, Bounds().Width(), 10),
|
||||
"intergal", B_TRANSLATE("Integration time [ms]: "), "",
|
||||
new BMessage(kIntegrationTimeChanged));
|
||||
fIntegrationTime->SetDivider(Bounds().Width() * 3 / 4);
|
||||
fIntegrationTime->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
||||
|
||||
dynamicLayout->AddView(fColorStepView);
|
||||
dynamicLayout->AddView(fIntegrationTime);
|
||||
|
||||
// status view
|
||||
BBox *statusBox = new BBox(rect, "statusBox");
|
||||
statusBox->SetLabel(B_TRANSLATE("CPU frequency status view"));
|
||||
BGroupLayout* statusLayout = new BGroupLayout(B_HORIZONTAL);
|
||||
statusLayout->SetInsets(10, statusBox->TopBorderOffset() * 2 + 10, 10, 10);
|
||||
statusLayout->SetSpacing(10);
|
||||
statusBox->SetLayout(statusLayout);
|
||||
mainLayout->AddView(statusBox);
|
||||
|
||||
fStatusView = new StatusView(BRect(0, 0, 5, 5), false, fStorage);
|
||||
fStatusView->ShowPopUpMenu(false);
|
||||
|
||||
fInstallButton = new BButton("installButton",
|
||||
B_TRANSLATE("Install replicant into Deskbar"),
|
||||
new BMessage(kInstallIntoDeskbar));
|
||||
|
||||
statusLayout->AddView(fStatusView);
|
||||
statusLayout->AddItem(BSpaceLayoutItem::CreateGlue());
|
||||
statusLayout->AddView(fInstallButton);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CPUFrequencyView::MessageReceived(BMessage* message)
|
||||
{
|
||||
freq_preferences* pref = fStorage->GetPreferences();
|
||||
bool configChanged = false;
|
||||
|
||||
switch (message->what) {
|
||||
case kUpdatedPreferences:
|
||||
fStatusView->MessageReceived(message);
|
||||
if (pref->mode == DYNAMIC) {
|
||||
fColorStepView->SetEnabled(true);
|
||||
fIntegrationTime->SetEnabled(true);
|
||||
}
|
||||
else {
|
||||
fColorStepView->SetEnabled(false);
|
||||
fIntegrationTime->SetEnabled(false);
|
||||
}
|
||||
configChanged = true;
|
||||
break;
|
||||
|
||||
case kSteppingChanged:
|
||||
// from ColorStepView
|
||||
pref->stepping_threshold = fColorStepView->GetSliderPosition();
|
||||
fStorage->SavePreferences();
|
||||
configChanged = true;
|
||||
break;
|
||||
|
||||
case kIntegrationTimeChanged:
|
||||
_ReadIntegrationTime();
|
||||
fStorage->SavePreferences();
|
||||
configChanged = true;
|
||||
break;
|
||||
|
||||
case kInstallIntoDeskbar:
|
||||
_InstallReplicantInDeskbar();
|
||||
break;
|
||||
|
||||
case kRevertMsg:
|
||||
case kDefaultMsg:
|
||||
fStatusView->UpdateCPUFreqState();
|
||||
_UpdateViews();
|
||||
break;
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
|
||||
if (configChanged)
|
||||
Window()->PostMessage(kConfigChangedMsg);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CPUFrequencyView::AttachedToWindow()
|
||||
{
|
||||
fFrequencyMenu = new FrequencyMenu(fPolicyMenu, this, fStorage,
|
||||
&fDriverInterface);
|
||||
AddFilter(fFrequencyMenu);
|
||||
|
||||
fColorStepView->SetTarget(this);
|
||||
fIntegrationTime->SetTarget(this);
|
||||
fInstallButton->SetTarget(this);
|
||||
|
||||
_UpdateViews();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CPUFrequencyView::DetachedFromWindow()
|
||||
{
|
||||
// emty menu for the case the view is attached again
|
||||
while (true) {
|
||||
BMenuItem* item = fPolicyMenu->RemoveItem(int32(0));
|
||||
if (!item)
|
||||
break;
|
||||
delete item;
|
||||
}
|
||||
if (RemoveFilter(fFrequencyMenu))
|
||||
delete fFrequencyMenu;
|
||||
|
||||
_ReadIntegrationTime();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
our_image(image_info& image)
|
||||
{
|
||||
int32 cookie = 0;
|
||||
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &image) == B_OK) {
|
||||
if ((char *)our_image >= (char *)image.text
|
||||
&& (char *)our_image <= (char *)image.text + image.text_size)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
CPUFrequencyView::_InstallReplicantInDeskbar()
|
||||
{
|
||||
image_info info;
|
||||
entry_ref ref;
|
||||
if (our_image(info) == B_OK
|
||||
&& get_ref_for_path(info.name, &ref) == B_OK) {
|
||||
BDeskbar deskbar;
|
||||
deskbar.AddItem(&ref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CPUFrequencyView::_UpdateViews()
|
||||
{
|
||||
fFrequencyMenu->UpdateMenu();
|
||||
freq_preferences* pref = fStorage->GetPreferences();
|
||||
fColorStepView->SetSliderPosition(pref->stepping_threshold);
|
||||
if (pref->mode == DYNAMIC) {
|
||||
fColorStepView->SetEnabled(true);
|
||||
fIntegrationTime->SetEnabled(true);
|
||||
}
|
||||
else {
|
||||
fColorStepView->SetEnabled(false);
|
||||
fIntegrationTime->SetEnabled(false);
|
||||
}
|
||||
|
||||
BString out;
|
||||
out << pref->integration_time / kMilliSecond;
|
||||
fIntegrationTime->SetText(out.String());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CPUFrequencyView::_ReadIntegrationTime()
|
||||
{
|
||||
freq_preferences* pref = fStorage->GetPreferences();
|
||||
bigtime_t integration_time = atoi(fIntegrationTime->Text()) * kMilliSecond;
|
||||
if (integration_time == 0) {
|
||||
BString out;
|
||||
out << pref->integration_time / kMilliSecond;
|
||||
fIntegrationTime->SetText(out.String());
|
||||
}
|
||||
else {
|
||||
pref->integration_time = integration_time;
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
#ifndef CPUFREQUENCYVIEW_h
|
||||
#define CPUFREQUENCYVIEW_h
|
||||
|
||||
#include "DriverInterface.h"
|
||||
#include "ColorStepView.h"
|
||||
#include "PreferencesWindow.h"
|
||||
|
||||
#include <Handler.h>
|
||||
#include <Menu.h>
|
||||
#include <MenuItem.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
|
||||
extern const char* kPrefSignature;
|
||||
extern const char* kPreferencesFileName;
|
||||
|
||||
enum stepping_mode {
|
||||
DYNAMIC,
|
||||
PERFORMANCE,
|
||||
LOW_ENERGIE,
|
||||
CUSTOM
|
||||
};
|
||||
|
||||
|
||||
struct freq_preferences
|
||||
{
|
||||
bool IsEqual(const freq_preferences& prefs) {
|
||||
if (mode == prefs.mode && custom_stepping == prefs.custom_stepping
|
||||
&& stepping_threshold == prefs.stepping_threshold
|
||||
&& integration_time == prefs.integration_time)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// stepping mode
|
||||
stepping_mode mode;
|
||||
int16 custom_stepping;
|
||||
|
||||
// dynamic stepping
|
||||
float stepping_threshold;
|
||||
bigtime_t integration_time;
|
||||
};
|
||||
|
||||
|
||||
const freq_preferences kDefaultPreferences =
|
||||
{
|
||||
DYNAMIC,
|
||||
-1,
|
||||
0.25,
|
||||
500000 //half second
|
||||
};
|
||||
|
||||
|
||||
class FrequencyMenu;
|
||||
class StatusView;
|
||||
|
||||
class CPUFrequencyView : public BView
|
||||
{
|
||||
public:
|
||||
CPUFrequencyView(BRect frame,
|
||||
PreferencesStorage<freq_preferences>* storage);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
|
||||
private:
|
||||
void _InstallReplicantInDeskbar();
|
||||
void _UpdateViews();
|
||||
void _ReadIntegrationTime();
|
||||
|
||||
BMenu* fPolicyMenu;
|
||||
FrequencyMenu* fFrequencyMenu;
|
||||
ColorStepView* fColorStepView;
|
||||
BTextControl* fIntegrationTime;
|
||||
StatusView* fStatusView;
|
||||
BButton* fInstallButton;
|
||||
|
||||
PreferencesStorage<freq_preferences>* fStorage;
|
||||
CPUFreqDriverInterface fDriverInterface;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,333 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
#include "ColorStepView.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <Locale.h>
|
||||
#include <Window.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "Color Step View"
|
||||
|
||||
|
||||
const int32 kColorBarHeight = 15;
|
||||
|
||||
const uint32 kMSGSliderChanged = '&slc';
|
||||
|
||||
|
||||
ColorStepView::ColorStepView(BRect frame)
|
||||
: BControl(frame, "ColorStepView", "", new BMessage(kSteppingChanged),
|
||||
B_FOLLOW_ALL, B_WILL_DRAW),
|
||||
fOffScreenView(NULL),
|
||||
fOffScreenBitmap(NULL)
|
||||
{
|
||||
fPerformanceList = new PerformanceList(20, true);
|
||||
|
||||
fSliderPosition = 0;
|
||||
fNSteps = 0;
|
||||
fLowFreqColor.red = 0;
|
||||
fLowFreqColor.blue = 255;
|
||||
fLowFreqColor.green = 0;
|
||||
|
||||
fHighFreqColor.red = 255;
|
||||
fHighFreqColor.blue = 0;
|
||||
fHighFreqColor.green = 0;
|
||||
|
||||
fMinFrequencyLabel = "? MHz";
|
||||
fMaxFrequencyLabel = "? MHz";
|
||||
_InitView();
|
||||
}
|
||||
|
||||
|
||||
ColorStepView::~ColorStepView()
|
||||
{
|
||||
delete fPerformanceList;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::AttachedToWindow()
|
||||
{
|
||||
fSlider->SetTarget(this);
|
||||
|
||||
if (!fOffScreenView) {
|
||||
fOffScreenView = new BView(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
}
|
||||
if (!fOffScreenBitmap) {
|
||||
fOffScreenBitmap = new BBitmap(Bounds(), B_CMAP8, true, false);
|
||||
Window()->Lock();
|
||||
if (fOffScreenBitmap && fOffScreenView)
|
||||
fOffScreenBitmap->AddChild(fOffScreenView);
|
||||
Window()->Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::DetachedFromWindow()
|
||||
{
|
||||
BView::DetachedFromWindow();
|
||||
|
||||
if (fOffScreenBitmap) {
|
||||
delete fOffScreenBitmap;
|
||||
fOffScreenBitmap = NULL;
|
||||
fOffScreenView = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::FrameResized(float w,float h)
|
||||
{
|
||||
BView::FrameResized(w, h);
|
||||
|
||||
BRect bounds(Bounds());
|
||||
|
||||
if (bounds.right <= 0.0f || bounds.bottom <= 0.0f)
|
||||
return;
|
||||
|
||||
if (fOffScreenBitmap) {
|
||||
fOffScreenBitmap->RemoveChild(fOffScreenView);
|
||||
delete fOffScreenBitmap;
|
||||
|
||||
fOffScreenView->ResizeTo(bounds.Width(), bounds.Height());
|
||||
|
||||
fOffScreenBitmap = new BBitmap(Bounds(), B_RGBA32, true, false);
|
||||
fOffScreenBitmap->AddChild(fOffScreenView);
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::GetPreferredSize(float *width, float *height)
|
||||
{
|
||||
*width = Frame().Width();
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
|
||||
*height = fSlider->Frame().Height();
|
||||
*height += kColorBarHeight;
|
||||
*height += fontHeight.descent + fontHeight.ascent + 5;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::Draw(BRect updateRect)
|
||||
{
|
||||
BView *view = NULL;
|
||||
if(fOffScreenView){
|
||||
view = fOffScreenView;
|
||||
}
|
||||
else{
|
||||
view = this;
|
||||
}
|
||||
|
||||
if (!fOffScreenBitmap || !fOffScreenBitmap->Lock())
|
||||
return;
|
||||
view->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
view->SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
view->FillRect(updateRect);
|
||||
|
||||
BRect colorBarRect = fSlider->BarFrame();
|
||||
colorBarRect.top = 0;
|
||||
colorBarRect.bottom = kColorBarHeight;
|
||||
colorBarRect.OffsetTo(colorBarRect.left, fSlider->Frame().bottom);
|
||||
|
||||
float pos = 0.0;
|
||||
for (int i = fPerformanceList->CountItems() - 1; i >= 0 ; i--) {
|
||||
performance_step* perfState = fPerformanceList->ItemAt(i);
|
||||
|
||||
float nextPos = perfState->cpu_usage;
|
||||
float width = colorBarRect.Width();
|
||||
|
||||
BRect subRect(colorBarRect);
|
||||
subRect.left += pos * width;
|
||||
subRect.right = colorBarRect.left + nextPos * width;
|
||||
|
||||
view->SetHighColor(perfState->color);
|
||||
view->FillRect(subRect);
|
||||
|
||||
pos = nextPos;
|
||||
}
|
||||
// draw label
|
||||
if (IsEnabled())
|
||||
view->SetHighColor(0, 0, 0);
|
||||
else
|
||||
view->SetHighColor(tint_color(LowColor(), B_DISABLED_LABEL_TINT));
|
||||
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
float totalFontHeight = fontHeight.descent + fontHeight.ascent;
|
||||
|
||||
view->DrawString(fMinFrequencyLabel.String(),
|
||||
BPoint(0.0,
|
||||
colorBarRect.bottom + totalFontHeight + 5));
|
||||
|
||||
view->DrawString(fMaxFrequencyLabel.String(),
|
||||
BPoint(Bounds().right
|
||||
- StringWidth(fMaxFrequencyLabel.String()),
|
||||
colorBarRect.bottom + totalFontHeight + 5));
|
||||
|
||||
// blit bitmap
|
||||
view->Sync();
|
||||
fOffScreenBitmap->Unlock();
|
||||
DrawBitmap(fOffScreenBitmap, B_ORIGIN);
|
||||
|
||||
BView::Draw(updateRect);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::MessageReceived(BMessage *message)
|
||||
{
|
||||
switch (message->what) {
|
||||
case kMSGSliderChanged:
|
||||
fSliderPosition = fSlider->Position();
|
||||
_CalculatePerformanceSteps();
|
||||
Invalidate();
|
||||
break;
|
||||
case kSteppingChanged:
|
||||
Invoke();
|
||||
break;
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::SetEnabled(bool enabled)
|
||||
{
|
||||
fSlider->SetEnabled(enabled);
|
||||
BControl::SetEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::SetFrequencys(StateList *list)
|
||||
{
|
||||
fStateList = list;
|
||||
fNSteps = fStateList->CountItems();
|
||||
if (fNSteps >= 2) {
|
||||
float minFreq = fStateList->ItemAt(fNSteps - 1)->frequency;
|
||||
float maxFreq = fStateList->ItemAt(0)->frequency;
|
||||
fMinFrequencyLabel = CreateFrequencyString(minFreq);
|
||||
fMaxFrequencyLabel = CreateFrequencyString(maxFreq);
|
||||
}
|
||||
|
||||
// fit size of fPerformanceList
|
||||
int32 perfNumber = fPerformanceList->CountItems();
|
||||
if (perfNumber < fNSteps) {
|
||||
for (int i = 0; i < fNSteps - perfNumber; i++)
|
||||
fPerformanceList->AddItem(new performance_step);
|
||||
} else {
|
||||
for (int i = 0; i < perfNumber - fNSteps; i++)
|
||||
fPerformanceList->RemoveItemAt(0);
|
||||
}
|
||||
// and fill the list
|
||||
_CalculatePerformanceSteps();
|
||||
|
||||
}
|
||||
|
||||
|
||||
PerformanceList*
|
||||
ColorStepView::GetPerformanceSteps()
|
||||
{
|
||||
return fPerformanceList;
|
||||
}
|
||||
|
||||
|
||||
BString
|
||||
ColorStepView::CreateFrequencyString(uint16 frequency)
|
||||
{
|
||||
BString string = "";
|
||||
if (frequency >= 1000) {
|
||||
char buffer [10];
|
||||
sprintf (buffer, "%.1f", float(frequency) / 1000);
|
||||
string << buffer;
|
||||
string += " GHz";
|
||||
}
|
||||
else {
|
||||
string << frequency;
|
||||
string += " MHz";
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
float
|
||||
ColorStepView::UsageOfStep(int32 step, int32 nSteps, float base)
|
||||
{
|
||||
float singleWidth = (1 - base) / (nSteps - 1);
|
||||
return base + singleWidth * step;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::_InitView()
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
BRect sliderFrame(Bounds());
|
||||
|
||||
fSlider = new BSlider(sliderFrame, "StepSlider",
|
||||
B_TRANSLATE("Step up by CPU usage"),
|
||||
new BMessage(kSteppingChanged), 0, 100);
|
||||
fSlider->SetModificationMessage(new BMessage(kMSGSliderChanged));
|
||||
|
||||
fSliderPosition = 0.25 - fNSteps * 0.05;
|
||||
fSlider->SetPosition(fSliderPosition);
|
||||
fSlider->SetLimitLabels("0%", "100%");
|
||||
fSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
||||
fSlider->SetHashMarkCount(5);
|
||||
AddChild(fSlider);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::_CalculatePerformanceSteps()
|
||||
{
|
||||
for (int i = 0; i < fNSteps; i++) {
|
||||
// begin with the lowest frequency
|
||||
performance_step* perfState = fPerformanceList->ItemAt(fNSteps -1 - i);
|
||||
perfState->cpu_usage = _PositonStep(i);
|
||||
_ColorStep(i, perfState->color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
ColorStepView::_PositonStep(int32 step)
|
||||
{
|
||||
if (step >= fNSteps)
|
||||
return 1.0;
|
||||
|
||||
return UsageOfStep(step, fNSteps, fSliderPosition);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorStepView::_ColorStep(int32 step, rgb_color &color)
|
||||
{
|
||||
color.red = fLowFreqColor.red
|
||||
+ (fHighFreqColor.red - fLowFreqColor.red) * step / (fNSteps - 1);
|
||||
color.green = fLowFreqColor.green
|
||||
+ (fHighFreqColor.green - fLowFreqColor.green) * step / (fNSteps - 1);
|
||||
color.blue = fLowFreqColor.blue
|
||||
+ (fHighFreqColor.blue - fLowFreqColor.blue) * step / (fNSteps - 1);
|
||||
}
|
||||
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
#ifndef COLORSTEPVIEW_H
|
||||
#define COLORSTEPVIEW_H
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <Control.h>
|
||||
#include <ObjectList.h>
|
||||
#include <Slider.h>
|
||||
#include <String.h>
|
||||
|
||||
#include "DriverInterface.h"
|
||||
|
||||
const uint32 kSteppingChanged = '&spc';
|
||||
|
||||
struct performance_step {
|
||||
float cpu_usage; // upper limit
|
||||
rgb_color color;
|
||||
};
|
||||
|
||||
|
||||
typedef BObjectList<performance_step> PerformanceList;
|
||||
|
||||
|
||||
class ColorStepView : public BControl
|
||||
{
|
||||
public:
|
||||
ColorStepView(BRect frame);
|
||||
~ColorStepView();
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void FrameResized(float w,float h);
|
||||
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void SetEnabled(bool enabled);
|
||||
|
||||
void SetFrequencys(StateList *list);
|
||||
PerformanceList* GetPerformanceSteps();
|
||||
static BString CreateFrequencyString(uint16 frequency);
|
||||
|
||||
void SetSliderPosition(float pos) {
|
||||
fSlider->SetPosition(pos);
|
||||
fSliderPosition = pos;
|
||||
_CalculatePerformanceSteps();
|
||||
}
|
||||
float GetSliderPosition() { return fSliderPosition; }
|
||||
|
||||
static float UsageOfStep(int32 step, int32 nSteps, float base);
|
||||
|
||||
private:
|
||||
void _InitView();
|
||||
void _CalculatePerformanceSteps();
|
||||
float _PositonStep(int32 step);
|
||||
void _ColorStep(int32 step, rgb_color &color);
|
||||
|
||||
BSlider* fSlider;
|
||||
|
||||
float fSliderPosition;
|
||||
int32 fNSteps;
|
||||
rgb_color fLowFreqColor;
|
||||
rgb_color fHighFreqColor;
|
||||
|
||||
BView* fOffScreenView;
|
||||
BBitmap* fOffScreenBitmap;
|
||||
|
||||
BString fMinFrequencyLabel;
|
||||
BString fMaxFrequencyLabel;
|
||||
|
||||
PerformanceList* fPerformanceList;
|
||||
StateList* fStateList;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -1,222 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
#include "DriverInterface.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Directory.h>
|
||||
#include <Entry.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <Path.h>
|
||||
|
||||
|
||||
#define DRIVER_DIR "/dev/power"
|
||||
|
||||
CPUFreqDriverInterface::CPUFreqDriverInterface()
|
||||
: fInitOK(false),
|
||||
fDriverHandler(-1),
|
||||
fIsWatching(false),
|
||||
fWatchingMessenger(NULL)
|
||||
{
|
||||
fFrequencyStates = new StateList(20, true);
|
||||
|
||||
if (_FindSpeedStepDriver(DRIVER_DIR) == B_OK)
|
||||
fInitOK = true;
|
||||
|
||||
status_t ret;
|
||||
freq_info states[MAX_CPU_FREQUENCY_STATES];
|
||||
ret = ioctl(fDriverHandler, GET_CPU_FREQ_STATES, &states,
|
||||
sizeof(freq_info) * MAX_CPU_FREQUENCY_STATES);
|
||||
if (ret != B_OK)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < MAX_CPU_FREQUENCY_STATES && states[i].frequency != 0;
|
||||
i++) {
|
||||
fFrequencyStates->AddItem(new freq_info(states[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CPUFreqDriverInterface::~CPUFreqDriverInterface()
|
||||
{
|
||||
StopWatching();
|
||||
delete fFrequencyStates;
|
||||
|
||||
if (InitCheck() == B_OK)
|
||||
close(fDriverHandler);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
CPUFreqDriverInterface::InitCheck()
|
||||
{
|
||||
if (fInitOK)
|
||||
return B_OK;
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
StateList*
|
||||
CPUFreqDriverInterface::GetCpuFrequencyStates()
|
||||
{
|
||||
return fFrequencyStates;
|
||||
}
|
||||
|
||||
|
||||
freq_info*
|
||||
CPUFreqDriverInterface::GetCurrentFrequencyState()
|
||||
{
|
||||
uint16 stateId = 0;
|
||||
status_t ret;
|
||||
ret = ioctl(fDriverHandler, GET_CURENT_CPU_FREQ_STATE, &stateId,
|
||||
sizeof(uint16));
|
||||
if (ret != B_OK)
|
||||
return NULL;
|
||||
int32 i = 0;
|
||||
while (true) {
|
||||
freq_info* state = fFrequencyStates->ItemAt(i);
|
||||
if (!state)
|
||||
break;
|
||||
i++;
|
||||
|
||||
if (state->id == stateId)
|
||||
return state;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
CPUFreqDriverInterface::GetNumberOfFrequencyStates()
|
||||
{
|
||||
return fFrequencyStates->CountItems();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
CPUFreqDriverInterface::SetFrequencyState(const freq_info* state)
|
||||
{
|
||||
status_t ret;
|
||||
ret = ioctl(fDriverHandler, SET_CPU_FREQ_STATE, &(state->id),
|
||||
sizeof(uint16));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
CPUFreqDriverInterface::StartWatching(BHandler* target)
|
||||
{
|
||||
if (fIsWatching)
|
||||
return B_ERROR;
|
||||
|
||||
if (fWatchingMessenger)
|
||||
delete fWatchingMessenger;
|
||||
fWatchingMessenger = new BMessenger(target);
|
||||
|
||||
status_t status = B_ERROR;
|
||||
fThreadId = spawn_thread(&_ThreadWatchFreqFunction, "FreqThread",
|
||||
B_LOW_PRIORITY, this);
|
||||
if (fThreadId >= 0)
|
||||
status = resume_thread(fThreadId);
|
||||
else
|
||||
return fThreadId;
|
||||
|
||||
if (status == B_OK) {
|
||||
fIsWatching = true;
|
||||
return B_OK;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
CPUFreqDriverInterface::StopWatching()
|
||||
{
|
||||
|
||||
if (fIsWatching &&
|
||||
ioctl(fDriverHandler, STOP_WATCHING_CPU_FREQ) == B_OK)
|
||||
{
|
||||
status_t status;
|
||||
status = wait_for_thread(fThreadId, &status);
|
||||
|
||||
delete fWatchingMessenger;
|
||||
fWatchingMessenger = NULL;
|
||||
|
||||
fIsWatching = false;
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
CPUFreqDriverInterface::_ThreadWatchFreqFunction(void* data)
|
||||
{
|
||||
CPUFreqDriverInterface* that = (CPUFreqDriverInterface*)data;
|
||||
that->_WatchFrequency();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CPUFreqDriverInterface::_WatchFrequency()
|
||||
{
|
||||
uint16 newId = 0;
|
||||
while (ioctl(fDriverHandler, WATCH_CPU_FREQ, &newId,
|
||||
sizeof(uint16)) == B_OK)
|
||||
{
|
||||
int i = 0;
|
||||
while (true) {
|
||||
freq_info* state = fFrequencyStates->ItemAt(i);
|
||||
if (!state)
|
||||
break;
|
||||
i++;
|
||||
|
||||
if (state->id == newId) {
|
||||
BMessage msg(kMSGFrequencyChanged);
|
||||
msg.AddPointer("freq_info", state);
|
||||
fWatchingMessenger->SendMessage(&msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
CPUFreqDriverInterface::_FindSpeedStepDriver(const char* path)
|
||||
{
|
||||
BDirectory dir(path);
|
||||
BEntry entry;
|
||||
|
||||
while (dir.GetNextEntry(&entry) == B_OK) {
|
||||
BPath path;
|
||||
entry.GetPath(&path);
|
||||
|
||||
if (entry.IsDirectory()) {
|
||||
if (_FindSpeedStepDriver(path.Path()) == B_OK)
|
||||
return B_OK;
|
||||
}
|
||||
else {
|
||||
fDriverHandler = open(path.Path(), O_RDWR);
|
||||
if (fDriverHandler >= 0) {
|
||||
uint32 magicId = 0;
|
||||
status_t ret;
|
||||
ret = ioctl(fDriverHandler, IDENTIFY_DEVICE, &magicId,
|
||||
sizeof(uint32));
|
||||
if (ret == B_OK && magicId == kMagicFreqID)
|
||||
return B_OK;
|
||||
else
|
||||
close(fDriverHandler);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return B_ERROR;
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
#ifndef DRIVERINTERFACE_H
|
||||
#define DRIVERINTERFACE_H
|
||||
|
||||
#include <Messenger.h>
|
||||
#include <ObjectList.h>
|
||||
|
||||
#include "device/power_managment.h"
|
||||
|
||||
const uint32 kMSGFrequencyChanged = '&frc';
|
||||
|
||||
typedef BObjectList<freq_info> StateList;
|
||||
|
||||
|
||||
class CPUFreqDriverInterface
|
||||
{
|
||||
public:
|
||||
CPUFreqDriverInterface();
|
||||
~CPUFreqDriverInterface();
|
||||
|
||||
status_t InitCheck();
|
||||
StateList* GetCpuFrequencyStates();
|
||||
freq_info* GetCurrentFrequencyState();
|
||||
int32 GetNumberOfFrequencyStates();
|
||||
status_t SetFrequencyState(const freq_info* state);
|
||||
|
||||
status_t StartWatching(BHandler* target);
|
||||
status_t StopWatching();
|
||||
private:
|
||||
static int32 _ThreadWatchFreqFunction(void* data);
|
||||
void _WatchFrequency();
|
||||
|
||||
thread_id fThreadId;
|
||||
status_t _FindSpeedStepDriver(const char* path);
|
||||
|
||||
bool fInitOK;
|
||||
int32 fDriverHandler;
|
||||
|
||||
StateList* fFrequencyStates;
|
||||
|
||||
bool fIsWatching;
|
||||
BMessenger* fWatchingMessenger;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -1,24 +0,0 @@
|
||||
SubDir HAIKU_TOP src preferences cpufrequency ;
|
||||
|
||||
UsePrivateHeaders shared ;
|
||||
|
||||
Preference CPUFrequency :
|
||||
ColorStepView.cpp
|
||||
CPUFrequencyView.cpp
|
||||
DriverInterface.cpp
|
||||
main.cpp
|
||||
StatusView.cpp
|
||||
: be $(TARGET_LIBSUPC++) localestub
|
||||
: cpufrequency.rdef
|
||||
;
|
||||
|
||||
DoCatalogs CPUFrequency :
|
||||
x-vnd.Haiku-CPUFrequencyPref
|
||||
:
|
||||
ColorStepView.cpp
|
||||
CPUFrequencyView.cpp
|
||||
main.cpp
|
||||
StatusView.cpp
|
||||
PreferencesWindow.h
|
||||
;
|
||||
|
@ -1,481 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
#ifndef PREFERENCES_WINDOW_h
|
||||
#define PREFERENCES_WINDOW_h
|
||||
|
||||
|
||||
#include <Application.h>
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <Debug.h>
|
||||
#include <Entry.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <File.h>
|
||||
#include <GroupView.h>
|
||||
#include <Locale.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <NodeMonitor.h>
|
||||
#include <Path.h>
|
||||
#include <Screen.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <String.h>
|
||||
#include <Window.h>
|
||||
|
||||
|
||||
#if DEBUG
|
||||
# define LOG(text...) PRINT((text))
|
||||
#else
|
||||
# define LOG(text...)
|
||||
#endif
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "Pref Window"
|
||||
|
||||
// messages PrefFileWatcher
|
||||
const uint32 kUpdatedPreferences = '&UdP';
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
class PreferencesStorage {
|
||||
public:
|
||||
PreferencesStorage(const char* file,
|
||||
const Preferences& defaultPreferences);
|
||||
~PreferencesStorage();
|
||||
|
||||
void Revert();
|
||||
void Defaults();
|
||||
|
||||
BPoint WindowPosition() {return fWindowPosition; }
|
||||
void SetWindowPosition(BPoint position)
|
||||
{ fWindowPosition = position; }
|
||||
|
||||
Preferences* GetPreferences() { return &fPreferences; }
|
||||
|
||||
status_t LoadPreferences();
|
||||
status_t SavePreferences();
|
||||
|
||||
BString& PreferencesFile() { return fPreferencesFile; }
|
||||
status_t GetPreferencesPath(BPath &path);
|
||||
|
||||
bool DefaultsSet();
|
||||
bool StartPrefsSet();
|
||||
|
||||
private:
|
||||
BString fPreferencesFile;
|
||||
|
||||
Preferences fPreferences;
|
||||
Preferences fStartPreferences;
|
||||
const Preferences& fDefaultPreferences;
|
||||
BPoint fWindowPosition;
|
||||
};
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
class PrefFileWatcher : public BMessageFilter {
|
||||
public:
|
||||
PrefFileWatcher(
|
||||
PreferencesStorage<Preferences>* storage,
|
||||
BHandler* target);
|
||||
virtual ~PrefFileWatcher();
|
||||
|
||||
virtual filter_result Filter(BMessage* message, BHandler** _target);
|
||||
|
||||
private:
|
||||
PreferencesStorage<Preferences>* fPreferencesStorage;
|
||||
node_ref fPreferencesNode;
|
||||
node_ref fPreferencesDirectoryNode;
|
||||
|
||||
BHandler* fTarget;
|
||||
};
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
class PreferencesWindow : public BWindow,
|
||||
public PreferencesStorage<Preferences> {
|
||||
public:
|
||||
PreferencesWindow(const char* title,
|
||||
const char* file,
|
||||
const Preferences& defaultPreferences);
|
||||
virtual ~PreferencesWindow();
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
virtual bool QuitRequested();
|
||||
|
||||
virtual bool SetPreferencesView(BView* prefView);
|
||||
|
||||
private:
|
||||
void _MoveToPosition();
|
||||
void _UpdateButtons();
|
||||
|
||||
BView* fPreferencesView;
|
||||
BButton* fRevertButton;
|
||||
BButton* fDefaultButton;
|
||||
BGroupLayout* fRootLayout;
|
||||
};
|
||||
|
||||
|
||||
const uint32 kDefaultMsg = 'dems';
|
||||
const uint32 kRevertMsg = 'rems';
|
||||
const uint32 kConfigChangedMsg = '&cgh';
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
PreferencesStorage<Preferences>::PreferencesStorage(const char* file,
|
||||
const Preferences& defaultPreferences)
|
||||
:
|
||||
fDefaultPreferences(defaultPreferences)
|
||||
{
|
||||
// default center position
|
||||
fWindowPosition.x = -1;
|
||||
fWindowPosition.y = -1;
|
||||
|
||||
fPreferencesFile = file;
|
||||
if (LoadPreferences() != B_OK)
|
||||
Defaults();
|
||||
fStartPreferences = fPreferences;
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
PreferencesStorage<Preferences>::~PreferencesStorage()
|
||||
{
|
||||
SavePreferences();
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
void
|
||||
PreferencesStorage<Preferences>::Revert()
|
||||
{
|
||||
fPreferences = fStartPreferences;
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
void
|
||||
PreferencesStorage<Preferences>::Defaults()
|
||||
{
|
||||
fPreferences = fDefaultPreferences;
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
status_t
|
||||
PreferencesStorage<Preferences>::GetPreferencesPath(BPath &path)
|
||||
{
|
||||
status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
return path.Append(fPreferencesFile.String());
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
status_t
|
||||
PreferencesStorage<Preferences>::LoadPreferences()
|
||||
{
|
||||
BPath path;
|
||||
status_t status = GetPreferencesPath(path);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
BFile settingsFile(path.Path(), B_READ_ONLY);
|
||||
status = settingsFile.InitCheck();
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
if (settingsFile.Read(&fWindowPosition, sizeof(BPoint))
|
||||
!= sizeof(BPoint)) {
|
||||
LOG("failed to load settings\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (settingsFile.Read(&fPreferences, sizeof(Preferences))
|
||||
!= sizeof(Preferences)) {
|
||||
LOG("failed to load settings\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
status_t
|
||||
PreferencesStorage<Preferences>::SavePreferences()
|
||||
{
|
||||
BPath path;
|
||||
status_t status = GetPreferencesPath(path);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
BFile settingsFile(path.Path(), B_READ_WRITE | B_CREATE_FILE);
|
||||
status = settingsFile.InitCheck();
|
||||
if (status != B_OK) {
|
||||
LOG("InitCheck() settings file failed \n");
|
||||
return status;
|
||||
}
|
||||
|
||||
if (settingsFile.Write(&fWindowPosition, sizeof(BPoint))
|
||||
!= sizeof(BPoint)) {
|
||||
LOG("can't save window position\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (settingsFile.Write(&fPreferences, sizeof(Preferences))
|
||||
!= sizeof(Preferences)) {
|
||||
LOG("can't save settings\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
bool
|
||||
PreferencesStorage<Preferences>::DefaultsSet()
|
||||
{
|
||||
return fPreferences.IsEqual(fDefaultPreferences);
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
bool
|
||||
PreferencesStorage<Preferences>::StartPrefsSet()
|
||||
{
|
||||
return fPreferences.IsEqual(fStartPreferences);
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
PrefFileWatcher<Preferences>::PrefFileWatcher(
|
||||
PreferencesStorage<Preferences>* storage, BHandler* target)
|
||||
:
|
||||
BMessageFilter(B_PROGRAMMED_DELIVERY, B_ANY_SOURCE),
|
||||
fPreferencesStorage(storage),
|
||||
fTarget(target)
|
||||
{
|
||||
BPath path;
|
||||
find_directory(B_USER_SETTINGS_DIRECTORY, &path);
|
||||
|
||||
BEntry entry(path.Path());
|
||||
if (entry.GetNodeRef(&fPreferencesDirectoryNode) == B_OK)
|
||||
watch_node(&fPreferencesDirectoryNode, B_WATCH_DIRECTORY, fTarget);
|
||||
|
||||
path.Append(fPreferencesStorage->PreferencesFile().String());
|
||||
entry.SetTo(path.Path());
|
||||
|
||||
if (entry.GetNodeRef(&fPreferencesNode) == B_OK)
|
||||
watch_node(&fPreferencesNode, B_WATCH_STAT, fTarget);
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
PrefFileWatcher<Preferences>::~PrefFileWatcher()
|
||||
{
|
||||
stop_watching(fTarget);
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
filter_result
|
||||
PrefFileWatcher<Preferences>::Filter(BMessage *msg, BHandler **target)
|
||||
{
|
||||
const char *name;
|
||||
ino_t dir = -1;
|
||||
filter_result result = B_DISPATCH_MESSAGE;
|
||||
int32 opcode;
|
||||
BPath path;
|
||||
node_ref nref;
|
||||
|
||||
if (msg->what != B_NODE_MONITOR
|
||||
|| msg->FindInt32("opcode", &opcode) != B_OK)
|
||||
return result;
|
||||
|
||||
switch (opcode) {
|
||||
case B_ENTRY_MOVED:
|
||||
msg->FindInt64("to directory", dir);
|
||||
if (dir != fPreferencesDirectoryNode.node)
|
||||
break;
|
||||
// supposed to fall through
|
||||
|
||||
case B_ENTRY_CREATED:
|
||||
msg->FindString("name", &name);
|
||||
fPreferencesStorage->GetPreferencesPath(path);
|
||||
if (path.Path() == name) {
|
||||
msg->FindInt32("device", &fPreferencesNode.device);
|
||||
msg->FindInt64("node", &fPreferencesNode.node);
|
||||
watch_node(&fPreferencesNode, B_WATCH_STAT, fTarget);
|
||||
}
|
||||
fPreferencesStorage->LoadPreferences();
|
||||
msg->what = kUpdatedPreferences;
|
||||
break;
|
||||
|
||||
case B_ENTRY_REMOVED:
|
||||
msg->FindInt32("device", &nref.device);
|
||||
msg->FindInt64("node", &nref.node);
|
||||
if (fPreferencesNode == nref) {
|
||||
// stop all watching
|
||||
stop_watching(fTarget);
|
||||
// and start watching the directory again
|
||||
watch_node(&fPreferencesDirectoryNode, B_WATCH_DIRECTORY,
|
||||
fTarget);
|
||||
msg->what = kUpdatedPreferences;
|
||||
}
|
||||
break;
|
||||
|
||||
case B_STAT_CHANGED:
|
||||
msg->FindInt32("device", &nref.device);
|
||||
msg->FindInt64("node", &nref.node);
|
||||
if (fPreferencesNode == nref) {
|
||||
fPreferencesStorage->LoadPreferences();
|
||||
msg->what = kUpdatedPreferences;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
PreferencesWindow<Preferences>::PreferencesWindow(const char* title,
|
||||
const char* file, const Preferences& defaultPreferences)
|
||||
:
|
||||
BWindow(BRect(50, 50, 400, 350), title, B_TITLED_WINDOW,
|
||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
|
||||
PreferencesStorage<Preferences>(file, defaultPreferences),
|
||||
fPreferencesView(NULL)
|
||||
{
|
||||
BGroupView* buttonView = new BGroupView(B_HORIZONTAL);
|
||||
fDefaultButton = new BButton(B_TRANSLATE("Defaults"),
|
||||
new BMessage(kDefaultMsg));
|
||||
buttonView->AddChild(fDefaultButton);
|
||||
|
||||
fRevertButton = new BButton(B_TRANSLATE("Revert"),
|
||||
new BMessage(kRevertMsg));
|
||||
buttonView->AddChild(fRevertButton);
|
||||
buttonView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
|
||||
|
||||
_UpdateButtons();
|
||||
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
fRootLayout = new BGroupLayout(B_VERTICAL);
|
||||
fRootLayout->SetInsets(B_USE_DEFAULT_SPACING);
|
||||
fRootLayout->SetSpacing(B_USE_DEFAULT_SPACING);
|
||||
BView* rootView = new BView("root view", 0, fRootLayout);
|
||||
AddChild(rootView);
|
||||
rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
fRootLayout->AddView(buttonView);
|
||||
|
||||
BSize size = fRootLayout->PreferredSize();
|
||||
ResizeTo(size.width, size.height);
|
||||
_MoveToPosition();
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
PreferencesWindow<Preferences>::~PreferencesWindow()
|
||||
{
|
||||
PreferencesStorage<Preferences>::SetWindowPosition(Frame().LeftTop());
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
void
|
||||
PreferencesWindow<Preferences>::MessageReceived(BMessage *msg)
|
||||
{
|
||||
switch(msg->what)
|
||||
{
|
||||
case kConfigChangedMsg:
|
||||
_UpdateButtons();
|
||||
break;
|
||||
|
||||
case kDefaultMsg:
|
||||
PreferencesStorage<Preferences>::Defaults();
|
||||
_UpdateButtons();
|
||||
if (fPreferencesView)
|
||||
PostMessage(kDefaultMsg, fPreferencesView);
|
||||
break;
|
||||
|
||||
case kRevertMsg:
|
||||
PreferencesStorage<Preferences>::Revert();
|
||||
_UpdateButtons();
|
||||
if (fPreferencesView)
|
||||
PostMessage(kRevertMsg, fPreferencesView);
|
||||
break;
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
bool
|
||||
PreferencesWindow<Preferences>::QuitRequested()
|
||||
{
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
bool
|
||||
PreferencesWindow<Preferences>::SetPreferencesView(BView* prefView)
|
||||
{
|
||||
if (fPreferencesView)
|
||||
return false;
|
||||
|
||||
fPreferencesView = prefView;
|
||||
fRootLayout->AddView(0, fPreferencesView);
|
||||
|
||||
BSize size = fRootLayout->PreferredSize();
|
||||
ResizeTo(size.width, size.height);
|
||||
_MoveToPosition();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
void
|
||||
PreferencesWindow<Preferences>::_MoveToPosition()
|
||||
{
|
||||
BPoint position = PreferencesStorage<Preferences>::WindowPosition();
|
||||
// center window on screen if it had a bad position
|
||||
if (position.x < 0 && position.y < 0){
|
||||
BRect rect = BScreen().Frame();
|
||||
BRect windowFrame = Frame();
|
||||
position.x = (rect.Width() - windowFrame.Width()) / 2;
|
||||
position.y = (rect.Height() - windowFrame.Height()) / 2;
|
||||
}
|
||||
MoveTo(position);
|
||||
}
|
||||
|
||||
|
||||
template<typename Preferences>
|
||||
void
|
||||
PreferencesWindow<Preferences>::_UpdateButtons()
|
||||
{
|
||||
if (!PreferencesStorage<Preferences>::DefaultsSet())
|
||||
fDefaultButton->SetEnabled(true);
|
||||
else
|
||||
fDefaultButton->SetEnabled(false);
|
||||
if (!PreferencesStorage<Preferences>::StartPrefsSet())
|
||||
fRevertButton->SetEnabled(true);
|
||||
else
|
||||
fRevertButton->SetEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
|
||||
#endif // PREFERENCES_WINDOW_h
|
@ -1,712 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
|
||||
#include "StatusView.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Application.h>
|
||||
#include <Catalog.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Deskbar.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <Locale.h>
|
||||
#include <MenuField.h>
|
||||
#include <MenuItem.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <Roster.h>
|
||||
#include <TextView.h>
|
||||
|
||||
#include "CPUFrequencyView.h"
|
||||
|
||||
|
||||
extern "C" _EXPORT BView *instantiate_deskbar_item(void);
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "Status view"
|
||||
#define MAX_FREQ_STRING "9999MHz"
|
||||
|
||||
|
||||
/* This file is used both by the preference panel and the deskbar replicant.
|
||||
* This make it needs two different BCatalogs depending on the context.
|
||||
* As this is not really possible with the current way BCatalog are built,
|
||||
* we get the catalog by hand. This makes us unable to use the TR macros,
|
||||
* and then collectcatkeys will not see the strings in the file.
|
||||
* So we mark them explicitly here.
|
||||
*/
|
||||
B_TRANSLATE_MARK_VOID("Dynamic performance");
|
||||
B_TRANSLATE_MARK_VOID("High performance");
|
||||
B_TRANSLATE_MARK_VOID("Low energy");
|
||||
B_TRANSLATE_MARK_VOID("Set state");
|
||||
B_TRANSLATE_MARK_VOID("CPUFrequency\n"
|
||||
"\twritten by Clemens Zeidler\n"
|
||||
"\tCopyright 2009, Haiku, Inc.\n");
|
||||
B_TRANSLATE_MARK_VOID("Ok");
|
||||
B_TRANSLATE_MARK_VOID("Open Speedstep preferences" B_UTF8_ELLIPSIS);
|
||||
B_TRANSLATE_MARK_VOID("Quit");
|
||||
|
||||
// messages FrequencySwitcher
|
||||
const uint32 kMsgDynamicPolicyPulse = '&dpp';
|
||||
|
||||
// messages menu
|
||||
const uint32 kMsgPolicyDynamic = 'pody';
|
||||
const uint32 kMsgPolicyPerformance = 'popr';
|
||||
const uint32 kMsgPolicyLowEnergy = 'pole';
|
||||
const uint32 kMsgPolicySetState = 'poss';
|
||||
|
||||
// messages StatusView
|
||||
const uint32 kMsgOpenSSPreferences = 'ossp';
|
||||
const char* kDeskbarItemName = "CPUFreqStatusView";
|
||||
|
||||
|
||||
FrequencySwitcher::FrequencySwitcher(CPUFreqDriverInterface* interface,
|
||||
BHandler* target)
|
||||
:
|
||||
BMessageFilter(B_PROGRAMMED_DELIVERY, B_ANY_SOURCE),
|
||||
fDriverInterface(interface),
|
||||
fTarget(target),
|
||||
fMessageRunner(NULL),
|
||||
fCurrentFrequency(NULL),
|
||||
fDynamicPolicyStarted(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FrequencySwitcher::~FrequencySwitcher()
|
||||
{
|
||||
freq_preferences dummyPref;
|
||||
_StartDynamicPolicy(false, dummyPref);
|
||||
}
|
||||
|
||||
|
||||
filter_result
|
||||
FrequencySwitcher::Filter(BMessage* message, BHandler** target)
|
||||
{
|
||||
filter_result result = B_DISPATCH_MESSAGE;
|
||||
if (message->what == kMsgDynamicPolicyPulse) {
|
||||
_CalculateDynamicState();
|
||||
result = B_SKIP_MESSAGE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FrequencySwitcher::SetMode(const freq_preferences& pref)
|
||||
{
|
||||
int16 stateCount = fDriverInterface->GetNumberOfFrequencyStates();
|
||||
StateList* list = fDriverInterface->GetCpuFrequencyStates();
|
||||
freq_info* currentState = fDriverInterface->GetCurrentFrequencyState();
|
||||
freq_info* state = NULL;
|
||||
bool isDynamic = false;
|
||||
|
||||
switch (pref.mode) {
|
||||
case DYNAMIC:
|
||||
isDynamic = true;
|
||||
fSteppingThreshold = pref.stepping_threshold;
|
||||
if (fMessageRunner && fIntegrationTime != pref.integration_time) {
|
||||
fIntegrationTime = pref.integration_time;
|
||||
fMessageRunner->SetInterval(fIntegrationTime);
|
||||
}
|
||||
if (!fDynamicPolicyStarted)
|
||||
_StartDynamicPolicy(true, pref);
|
||||
break;
|
||||
|
||||
case PERFORMANCE:
|
||||
state = list->ItemAt(int32(0));
|
||||
if (state != currentState)
|
||||
fDriverInterface->SetFrequencyState(state);
|
||||
break;
|
||||
|
||||
case LOW_ENERGIE:
|
||||
state = list->ItemAt(stateCount - 1);
|
||||
if (state != currentState)
|
||||
fDriverInterface->SetFrequencyState(state);
|
||||
break;
|
||||
|
||||
case CUSTOM:
|
||||
if (pref.custom_stepping < stateCount) {
|
||||
state = list->ItemAt(pref.custom_stepping);
|
||||
fDriverInterface->SetFrequencyState(state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isDynamic && fDynamicPolicyStarted) {
|
||||
fDynamicPolicyStarted = false;
|
||||
_StartDynamicPolicy(false, pref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FrequencySwitcher::_CalculateDynamicState()
|
||||
{
|
||||
system_info sysInfo;
|
||||
get_system_info(&sysInfo);
|
||||
bigtime_t now = system_time();
|
||||
bigtime_t activeTime = sysInfo.cpu_infos[0].active_time;
|
||||
|
||||
// if the dynamic mode is not started first init the prev values
|
||||
if (!fDynamicPolicyStarted) {
|
||||
fPrevActiveTime = activeTime;
|
||||
fPrevTime = now;
|
||||
fDynamicPolicyStarted = true;
|
||||
} else {
|
||||
float usage = (float)(activeTime - fPrevActiveTime )
|
||||
/ (now - fPrevTime);
|
||||
if (usage >= 1.0)
|
||||
usage = 0.9999999;
|
||||
|
||||
int32 numberOfStates = fDriverInterface->GetNumberOfFrequencyStates();
|
||||
for (int i = 0; i < numberOfStates; i++) {
|
||||
float usageOfStep = ColorStepView::UsageOfStep(i, numberOfStates,
|
||||
fSteppingThreshold);
|
||||
|
||||
if (usage < usageOfStep) {
|
||||
StateList* list = fDriverInterface->GetCpuFrequencyStates();
|
||||
freq_info* newState = list->ItemAt(numberOfStates - 1 - i);
|
||||
if (newState != fCurrentFrequency) {
|
||||
LOG("change freq\n");
|
||||
fDriverInterface->SetFrequencyState(newState);
|
||||
fCurrentFrequency = newState;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
fPrevActiveTime = activeTime;
|
||||
fPrevTime = now;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FrequencySwitcher::_StartDynamicPolicy(bool start, const freq_preferences& pref)
|
||||
{
|
||||
if (start) {
|
||||
if (!fMessageRunner) {
|
||||
fIntegrationTime = pref.integration_time;
|
||||
fMessageRunner = new BMessageRunner(fTarget,
|
||||
new BMessage(kMsgDynamicPolicyPulse), pref.integration_time, -1);
|
||||
fCurrentFrequency = fDriverInterface->GetCurrentFrequencyState();
|
||||
}
|
||||
} else {
|
||||
delete fMessageRunner;
|
||||
fMessageRunner = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
FrequencyMenu::FrequencyMenu(BMenu* menu, BHandler* target,
|
||||
PreferencesStorage<freq_preferences>* storage,
|
||||
CPUFreqDriverInterface* interface)
|
||||
: BMessageFilter(B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE),
|
||||
fTarget(target),
|
||||
fStorage(storage),
|
||||
fInterface(interface)
|
||||
{
|
||||
fDynamicPerformance = new BMenuItem(
|
||||
B_TRANSLATE("Dynamic performance"),
|
||||
new BMessage(kMsgPolicyDynamic));
|
||||
fHighPerformance = new BMenuItem(
|
||||
B_TRANSLATE("High performance"),
|
||||
new BMessage(kMsgPolicyPerformance));
|
||||
fLowEnergie = new BMenuItem(B_TRANSLATE("Low energy"),
|
||||
new BMessage(kMsgPolicyLowEnergy));
|
||||
|
||||
menu->AddItem(fDynamicPerformance);
|
||||
menu->AddItem(fHighPerformance);
|
||||
menu->AddItem(fLowEnergie);
|
||||
|
||||
fCustomStateMenu = new BMenu(B_TRANSLATE("Set state"));
|
||||
|
||||
StateList* stateList = fInterface->GetCpuFrequencyStates();
|
||||
for (int i = 0; i < stateList->CountItems(); i++) {
|
||||
freq_info* info = stateList->ItemAt(i);
|
||||
BString label;
|
||||
label << info->frequency;
|
||||
label += " MHz";
|
||||
fCustomStateMenu->AddItem(new BMenuItem(label.String(),
|
||||
new BMessage(kMsgPolicySetState)));
|
||||
}
|
||||
|
||||
menu->AddItem(fCustomStateMenu);
|
||||
|
||||
// set the target of the items
|
||||
fDynamicPerformance->SetTarget(fTarget);
|
||||
fHighPerformance->SetTarget(fTarget);
|
||||
fLowEnergie->SetTarget(fTarget);
|
||||
|
||||
fCustomStateMenu->SetTargetForItems(fTarget);
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
FrequencyMenu::_SetL1MenuLabelFrom(BMenuItem* item)
|
||||
{
|
||||
BMenuItem* superItem, *markedItem;
|
||||
superItem = item->Menu()->Superitem();
|
||||
if (superItem)
|
||||
superItem->SetLabel(item->Label());
|
||||
markedItem = item->Menu()->FindMarked();
|
||||
if (markedItem)
|
||||
markedItem->SetMarked(false);
|
||||
item->SetMarked(true);
|
||||
}
|
||||
|
||||
|
||||
filter_result
|
||||
FrequencyMenu::Filter(BMessage* msg, BHandler** target)
|
||||
{
|
||||
filter_result result = B_DISPATCH_MESSAGE;
|
||||
|
||||
BMenuItem* item, *superItem, *markedItem;
|
||||
msg->FindPointer("source", (void**)&item);
|
||||
if (!item)
|
||||
return result;
|
||||
|
||||
bool safeChanges = false;
|
||||
freq_preferences* pref = fStorage->GetPreferences();
|
||||
|
||||
switch (msg->what) {
|
||||
case kMsgPolicyDynamic:
|
||||
pref->mode = DYNAMIC;
|
||||
_SetL1MenuLabelFrom(item);
|
||||
safeChanges = true;
|
||||
msg->what = kUpdatedPreferences;
|
||||
break;
|
||||
|
||||
case kMsgPolicyPerformance:
|
||||
pref->mode = PERFORMANCE;
|
||||
_SetL1MenuLabelFrom(item);
|
||||
safeChanges = true;
|
||||
msg->what = kUpdatedPreferences;
|
||||
break;
|
||||
|
||||
case kMsgPolicyLowEnergy:
|
||||
pref->mode = LOW_ENERGIE;
|
||||
_SetL1MenuLabelFrom(item);
|
||||
safeChanges = true;
|
||||
msg->what = kUpdatedPreferences;
|
||||
break;
|
||||
|
||||
case kMsgPolicySetState:
|
||||
pref->mode = CUSTOM;
|
||||
pref->custom_stepping = item->Menu()->IndexOf(item);
|
||||
|
||||
superItem = item->Menu()->Supermenu()->Superitem();
|
||||
if (superItem)
|
||||
superItem->SetLabel(item->Label());
|
||||
markedItem = item->Menu()->Supermenu()->FindMarked();
|
||||
if (markedItem)
|
||||
markedItem->SetMarked(false);
|
||||
markedItem = item->Menu()->FindMarked();
|
||||
if (markedItem)
|
||||
markedItem->SetMarked(false);
|
||||
item->SetMarked(true);
|
||||
|
||||
safeChanges = true;
|
||||
msg->what = kUpdatedPreferences;
|
||||
break;
|
||||
}
|
||||
|
||||
if (safeChanges)
|
||||
fStorage->SavePreferences();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FrequencyMenu::UpdateMenu()
|
||||
{
|
||||
freq_preferences* pref = fStorage->GetPreferences();
|
||||
switch (pref->mode) {
|
||||
case DYNAMIC:
|
||||
_SetL1MenuLabelFrom(fDynamicPerformance);
|
||||
break;
|
||||
|
||||
case PERFORMANCE:
|
||||
_SetL1MenuLabelFrom(fHighPerformance);
|
||||
break;
|
||||
|
||||
case LOW_ENERGIE:
|
||||
_SetL1MenuLabelFrom(fLowEnergie);
|
||||
break;
|
||||
|
||||
case CUSTOM:
|
||||
{
|
||||
BMenuItem* markedItem = fCustomStateMenu->FindMarked();
|
||||
if (markedItem)
|
||||
markedItem->SetMarked(false);
|
||||
BMenuItem* customItem
|
||||
= fCustomStateMenu->ItemAt(pref->custom_stepping);
|
||||
if (customItem)
|
||||
customItem->SetMarked(true);
|
||||
BMenuItem* superItem = fCustomStateMenu->Supermenu()->Superitem();
|
||||
if (superItem && customItem)
|
||||
superItem->SetLabel(customItem->Label());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
StatusView::StatusView(BRect frame, bool inDeskbar,
|
||||
PreferencesStorage<freq_preferences>* storage)
|
||||
:
|
||||
BView(frame, kDeskbarItemName, B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS),
|
||||
fInDeskbar(inDeskbar),
|
||||
fCurrentFrequency(NULL),
|
||||
fDragger(NULL)
|
||||
{
|
||||
if (!inDeskbar) {
|
||||
// we were obviously added to a standard window - let's add a dragger
|
||||
BRect bounds = Bounds();
|
||||
bounds.top = bounds.bottom - 7;
|
||||
bounds.left = bounds.right - 7;
|
||||
fDragger = new BDragger(bounds, this,
|
||||
B_FOLLOW_NONE);
|
||||
AddChild(fDragger);
|
||||
}
|
||||
|
||||
if (storage) {
|
||||
fOwningStorage = false;
|
||||
fStorage = storage;
|
||||
} else {
|
||||
fOwningStorage = true;
|
||||
fStorage = new PreferencesStorage<freq_preferences>("CPUFrequency",
|
||||
kDefaultPreferences);
|
||||
}
|
||||
|
||||
_Init();
|
||||
}
|
||||
|
||||
|
||||
StatusView::StatusView(BMessage* archive)
|
||||
: BView(archive),
|
||||
fInDeskbar(false),
|
||||
fCurrentFrequency(NULL),
|
||||
fDragger(NULL)
|
||||
{
|
||||
app_info info;
|
||||
if (be_app->GetAppInfo(&info) == B_OK
|
||||
&& !strcasecmp(info.signature, "application/x-vnd.Be-TSKB"))
|
||||
fInDeskbar = true;
|
||||
|
||||
fOwningStorage = true;
|
||||
fStorage = new PreferencesStorage<freq_preferences>(kPreferencesFileName,
|
||||
kDefaultPreferences);
|
||||
_Init();
|
||||
}
|
||||
|
||||
|
||||
StatusView::~StatusView()
|
||||
{
|
||||
if (fOwningStorage)
|
||||
delete fStorage;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::_AboutRequested()
|
||||
{
|
||||
BAlert *alert = new BAlert("about", B_TRANSLATE("CPUFrequency\n"
|
||||
"\twritten by Clemens Zeidler\n"
|
||||
"\tCopyright 2009, Haiku, Inc.\n"),
|
||||
B_TRANSLATE("OK"));
|
||||
BTextView *view = alert->TextView();
|
||||
BFont font;
|
||||
|
||||
view->SetStylable(true);
|
||||
|
||||
view->GetFont(&font);
|
||||
font.SetSize(18);
|
||||
font.SetFace(B_BOLD_FACE);
|
||||
view->SetFontAndColor(0, 13, &font);
|
||||
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::_Quit()
|
||||
{
|
||||
if (fInDeskbar) {
|
||||
BDeskbar deskbar;
|
||||
deskbar.RemoveItem(kDeskbarItemName);
|
||||
} else
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
|
||||
|
||||
StatusView*
|
||||
StatusView::Instantiate(BMessage* archive)
|
||||
{
|
||||
if (!validate_instantiation(archive, "StatusView"))
|
||||
return NULL;
|
||||
|
||||
return new StatusView(archive);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
StatusView::Archive(BMessage* archive, bool deep) const
|
||||
{
|
||||
status_t status = BView::Archive(archive, deep);
|
||||
if (status == B_OK)
|
||||
status = archive->AddString("add_on", kPrefSignature);
|
||||
if (status == B_OK)
|
||||
status = archive->AddString("class", "StatusView");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::AttachedToWindow()
|
||||
{
|
||||
BView::AttachedToWindow();
|
||||
if (Parent()) {
|
||||
if ((Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0)
|
||||
SetViewColor(B_TRANSPARENT_COLOR);
|
||||
else
|
||||
SetViewColor(Parent()->ViewColor());
|
||||
} else
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
SetLowColor(ViewColor());
|
||||
|
||||
// watching if the driver change the frequency
|
||||
fDriverInterface.StartWatching(this);
|
||||
|
||||
// monitor preferences file
|
||||
fPrefFileWatcher = new PrefFileWatcher<freq_preferences>(fStorage, this);
|
||||
AddFilter(fPrefFileWatcher);
|
||||
|
||||
// FrequencySwitcher
|
||||
fFrequencySwitcher = new FrequencySwitcher(&fDriverInterface, this);
|
||||
fFrequencySwitcher->SetMode(*(fStorage->GetPreferences()));
|
||||
AddFilter(fFrequencySwitcher);
|
||||
|
||||
// perferences menu
|
||||
fPreferencesMenu = new BPopUpMenu(B_EMPTY_STRING, false, false);
|
||||
fPreferencesMenuFilter = new FrequencyMenu(fPreferencesMenu, this,
|
||||
fStorage, &fDriverInterface);
|
||||
|
||||
fPreferencesMenu->SetFont(be_plain_font);
|
||||
|
||||
fPreferencesMenu->AddSeparatorItem();
|
||||
fOpenPrefItem = new BMenuItem(B_TRANSLATE(
|
||||
"Open Speedstep preferences" B_UTF8_ELLIPSIS),
|
||||
new BMessage(kMsgOpenSSPreferences));
|
||||
fPreferencesMenu->AddItem(fOpenPrefItem);
|
||||
fOpenPrefItem->SetTarget(this);
|
||||
|
||||
if (fInDeskbar) {
|
||||
fQuitItem= new BMenuItem(B_TRANSLATE("Quit"),
|
||||
new BMessage(B_QUIT_REQUESTED));
|
||||
fPreferencesMenu->AddItem(fQuitItem);
|
||||
fQuitItem->SetTarget(this);
|
||||
}
|
||||
AddFilter(fPreferencesMenuFilter);
|
||||
|
||||
fPreferencesMenuFilter->UpdateMenu();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::DetachedFromWindow()
|
||||
{
|
||||
fDriverInterface.StopWatching();
|
||||
|
||||
if (RemoveFilter(fPrefFileWatcher))
|
||||
delete fPrefFileWatcher;
|
||||
if (RemoveFilter(fFrequencySwitcher))
|
||||
delete fFrequencySwitcher;
|
||||
if (RemoveFilter(fPreferencesMenuFilter))
|
||||
delete fPreferencesMenuFilter;
|
||||
delete fPreferencesMenu;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
case kMsgOpenSSPreferences:
|
||||
_OpenPreferences();
|
||||
break;
|
||||
|
||||
case kMSGFrequencyChanged:
|
||||
message->FindPointer("freq_info", (void**)&fCurrentFrequency);
|
||||
_SetupNewFreqString();
|
||||
Invalidate();
|
||||
break;
|
||||
|
||||
case kUpdatedPreferences:
|
||||
fFrequencySwitcher->SetMode(*(fStorage->GetPreferences()));
|
||||
fPreferencesMenuFilter->UpdateMenu();
|
||||
break;
|
||||
|
||||
case B_ABOUT_REQUESTED:
|
||||
_AboutRequested();
|
||||
break;
|
||||
|
||||
case B_QUIT_REQUESTED:
|
||||
_Quit();
|
||||
break;
|
||||
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::FrameResized(float width, float height)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::Draw(BRect updateRect)
|
||||
{
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
float height = fontHeight.ascent + fontHeight.descent;
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
be_control_look->DrawLabel(this, fFreqString.String(),
|
||||
Parent()->ViewColor(), 0, BPoint(0, height));
|
||||
} else {
|
||||
MovePenTo(0, height);
|
||||
DrawString(fFreqString.String());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
StatusView::MouseDown(BPoint point)
|
||||
{
|
||||
if (fShowPopUpMenu) {
|
||||
ConvertToScreen(&point);
|
||||
fPreferencesMenu->Go(point, true, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::GetPreferredSize(float *width, float *height)
|
||||
{
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
*height = fontHeight.ascent + fontHeight.descent;
|
||||
if (!fInDeskbar)
|
||||
*height += 7;
|
||||
|
||||
*width = StringWidth(MAX_FREQ_STRING);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::ResizeToPreferred(void)
|
||||
{
|
||||
float width, height;
|
||||
GetPreferredSize(&width, &height);
|
||||
ResizeTo(width, height);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::ShowPopUpMenu(bool show)
|
||||
{
|
||||
fShowPopUpMenu = show;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::UpdateCPUFreqState()
|
||||
{
|
||||
fFrequencySwitcher->SetMode(*(fStorage->GetPreferences()));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::_Init()
|
||||
{
|
||||
fShowPopUpMenu = true;
|
||||
fCurrentFrequency = fDriverInterface.GetCurrentFrequencyState();
|
||||
|
||||
_SetupNewFreqString();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::_SetupNewFreqString()
|
||||
{
|
||||
if (fCurrentFrequency) {
|
||||
fFreqString = ColorStepView::CreateFrequencyString(
|
||||
fCurrentFrequency->frequency);
|
||||
} else
|
||||
fFreqString = "? MHz";
|
||||
|
||||
ResizeToPreferred();
|
||||
|
||||
if (fDragger) {
|
||||
BRect bounds = Bounds();
|
||||
fDragger->MoveTo(bounds.right - 7, bounds.bottom - 7);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
StatusView::_OpenPreferences()
|
||||
{
|
||||
status_t ret = be_roster->Launch(kPrefSignature);
|
||||
if (ret == B_ALREADY_RUNNING) {
|
||||
app_info info;
|
||||
ret = be_roster->GetAppInfo(kPrefSignature, &info);
|
||||
if (ret == B_OK)
|
||||
ret = be_roster->ActivateApp(info.team);
|
||||
}
|
||||
if (ret < B_OK) {
|
||||
BString errorMessage(B_TRANSLATE(
|
||||
"Launching the CPU frequency preflet failed.\n\nError: "));
|
||||
errorMessage << strerror(ret);
|
||||
BAlert* alert = new BAlert("launch error", errorMessage.String(),
|
||||
"OK");
|
||||
// asynchronous alert in order to not block replicant host
|
||||
// application
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern "C" _EXPORT BView*
|
||||
instantiate_deskbar_item(void)
|
||||
{
|
||||
return new StatusView(BRect(0, 0, 15, 15), true, NULL);
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
#ifndef STATUS_VIEW_H
|
||||
#define STATUS_VIEW_H
|
||||
|
||||
|
||||
#include <Dragger.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <MessageRunner.h>
|
||||
#include <String.h>
|
||||
#include <View.h>
|
||||
|
||||
#include "CPUFrequencyView.h"
|
||||
#include "DriverInterface.h"
|
||||
#include "PreferencesWindow.h"
|
||||
|
||||
|
||||
extern const char* kDeskbarItemName;
|
||||
extern const char* kAddonSignature;
|
||||
|
||||
|
||||
class FrequencySwitcher : public BMessageFilter {
|
||||
public:
|
||||
FrequencySwitcher(
|
||||
CPUFreqDriverInterface* interface,
|
||||
BHandler* target);
|
||||
virtual ~FrequencySwitcher();
|
||||
|
||||
virtual filter_result Filter(BMessage* message, BHandler** _target);
|
||||
|
||||
void SetMode(const freq_preferences& pref);
|
||||
|
||||
private:
|
||||
void _CalculateDynamicState();
|
||||
void _StartDynamicPolicy(bool start,
|
||||
const freq_preferences& pref);
|
||||
|
||||
CPUFreqDriverInterface* fDriverInterface;
|
||||
BHandler* fTarget;
|
||||
BMessageRunner* fMessageRunner;
|
||||
|
||||
freq_info* fCurrentFrequency;
|
||||
|
||||
bool fDynamicPolicyStarted;
|
||||
bigtime_t fPrevActiveTime;
|
||||
bigtime_t fPrevTime;
|
||||
float fSteppingThreshold;
|
||||
bigtime_t fIntegrationTime;
|
||||
};
|
||||
|
||||
|
||||
class FrequencyMenu : public BMessageFilter {
|
||||
public:
|
||||
FrequencyMenu(BMenu* menu, BHandler* target,
|
||||
PreferencesStorage<freq_preferences>*
|
||||
storage,
|
||||
CPUFreqDriverInterface* interface);
|
||||
virtual filter_result Filter(BMessage* message, BHandler** _target);
|
||||
|
||||
void UpdateMenu();
|
||||
|
||||
private:
|
||||
inline void _SetL1MenuLabelFrom(BMenuItem* item);
|
||||
|
||||
BHandler* fTarget;
|
||||
BMenuItem* fDynamicPerformance;
|
||||
BMenuItem* fHighPerformance;
|
||||
BMenuItem* fLowEnergie;
|
||||
BMenu* fCustomStateMenu;
|
||||
|
||||
PreferencesStorage<freq_preferences>* fStorage;
|
||||
CPUFreqDriverInterface* fInterface;
|
||||
};
|
||||
|
||||
|
||||
class StatusView : public BView {
|
||||
public:
|
||||
StatusView(BRect frame, bool inDeskbar = false,
|
||||
PreferencesStorage<freq_preferences>*
|
||||
storage = NULL);
|
||||
StatusView(BMessage* archive);
|
||||
virtual ~StatusView();
|
||||
|
||||
static StatusView* Instantiate(BMessage* archive);
|
||||
virtual status_t Archive(BMessage* archive,
|
||||
bool deep = true) const;
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void Draw(BRect updateRect);
|
||||
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void ResizeToPreferred(void);
|
||||
|
||||
virtual void ShowPopUpMenu(bool show = true);
|
||||
|
||||
virtual void UpdateCPUFreqState();
|
||||
|
||||
private:
|
||||
void _Init();
|
||||
void _SetupNewFreqString();
|
||||
void _OpenPreferences();
|
||||
void _AboutRequested();
|
||||
void _Quit();
|
||||
|
||||
bool fInDeskbar;
|
||||
|
||||
CPUFreqDriverInterface fDriverInterface;
|
||||
freq_info* fCurrentFrequency;
|
||||
FrequencySwitcher* fFrequencySwitcher;
|
||||
|
||||
bool fShowPopUpMenu;
|
||||
BPopUpMenu* fPreferencesMenu;
|
||||
BMenuItem* fOpenPrefItem;
|
||||
BMenuItem* fQuitItem;
|
||||
|
||||
FrequencyMenu* fPreferencesMenuFilter;
|
||||
bool fOwningStorage;
|
||||
PreferencesStorage<freq_preferences>* fStorage;
|
||||
PrefFileWatcher<freq_preferences>* fPrefFileWatcher;
|
||||
|
||||
BString fFreqString;
|
||||
BDragger* fDragger;
|
||||
};
|
||||
|
||||
#endif // STATUS_VIEW_H
|
@ -1,45 +0,0 @@
|
||||
|
||||
resource app_signature "application/x-vnd.Haiku-CPUFrequencyPref";
|
||||
|
||||
resource app_name_catalog_entry "x-vnd.Haiku-CPUFrequencyPref:System name:CPUFrequency";
|
||||
|
||||
resource app_version {
|
||||
major = 1,
|
||||
middle = 0,
|
||||
minor = 0,
|
||||
|
||||
variety = B_APPV_FINAL,
|
||||
internal = 0,
|
||||
|
||||
short_info = "CPUFrequency",
|
||||
long_info = "CPUFrequency ©2008-2009 Haiku, Inc."
|
||||
};
|
||||
|
||||
resource app_flags B_SINGLE_LAUNCH;
|
||||
|
||||
resource vector_icon {
|
||||
$"6E6369660E03010000020002023980000000000000004000004BE00008908100"
|
||||
$"010000FFFF01000000020016023CC7EE389BC0BA16573E39B04977C842ADC700"
|
||||
$"FFFFD3020006023C529D3753A2B8966F3D9D084B6044496AAF00474747FFA5A0"
|
||||
$"A002001602BC4E76BC411B3C90DABCA00D47587D4ABA850090FFD40200160238"
|
||||
$"313C3B5CF0BFCD963C7AAC4C13943FCAF901ECFFC3054B04017E020006033E2F"
|
||||
$"99387F17BA42DB3FF5B94A0E32482C90001D1E2C3D454658FF01010102000602"
|
||||
$"3879063B8224BE2CC83B10DB4A1F6F49B894FF9A9A9A00242222020006033C69"
|
||||
$"A60000000000003E186148800049800058F3F3F300D4CECEFFD9D9D902000603"
|
||||
$"3C1F1A33E78CB7ACC03FFE4F48BB3EBD7B6C0078D905818CFF05FF7ADD050200"
|
||||
$"1602349C2E37B5FABA1F6036FC624A3E004B320001D3FF910200160235777837"
|
||||
$"0A67B7E8CE363A844A1D684B45D800F3FF2E0D0A04486050605C51544E04033E"
|
||||
$"5349594856475C49604B5C4E604B0A06262A264C485E5252523030240A04262A"
|
||||
$"4838523030240A044838485E525252300A04262A264C485E48380A04453A4553"
|
||||
$"2844282E0A04B6F9C0F42845282EB701B8EC0A044550455328452AC0F30A0445"
|
||||
$"3A45502A43B701B8EC0408AEBAB6BCBCC32FBD4F2E3930BDA8B9ACC0A5BA9EBC"
|
||||
$"03BB1EBFD937BF0DBD4FC072BCC3C019BDDBC0CB46460204BF23C726BF91C70D"
|
||||
$"BEB5C73FBE9FC87EBE7AC7D9BEC5C922BFAAC97BBF3CC994C018C962C02DC823"
|
||||
$"C053C8C8C008C77F0204BFCEC6FBC042C6E0BF5BC715BF48C85ABF1FC7B3BF71"
|
||||
$"C902C063C95ABFF0C974C0D7C93FC0EAC7FAC113C8A2C0C1C7530E0A07010000"
|
||||
$"0A0101011001178300040A0001021001178400040A020103000A080109000A0B"
|
||||
$"010A1001178120040A030104000A04020506000A090107000A0A0108000A0D01"
|
||||
$"0C0815FF0A0C010B0815FF0A0D010C0A3FEAF70000000000003FEAF7C573B4C2"
|
||||
$"770615FF0A0C010B0A3FEAF70000000000003FEAF7C573B4C2770615FF"
|
||||
};
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
|
||||
#include <Application.h>
|
||||
#include <Catalog.h>
|
||||
#include <Locale.h>
|
||||
|
||||
#include "CPUFrequencyView.h"
|
||||
#include "PreferencesWindow.h"
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "Main window"
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
BApplication *app = new BApplication(kPrefSignature);
|
||||
|
||||
PreferencesWindow<freq_preferences> *window;
|
||||
window = new PreferencesWindow<freq_preferences>(
|
||||
B_TRANSLATE_SYSTEM_NAME("CPUFrequency"), kPreferencesFileName,
|
||||
kDefaultPreferences);
|
||||
CPUFrequencyView* prefView
|
||||
= new CPUFrequencyView(BRect(0, 0, 400, 350), window);
|
||||
window->SetPreferencesView(prefView);
|
||||
window->Show();
|
||||
app->Run();
|
||||
|
||||
delete app;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user