📢 Webサイト閉鎖と移転のお知らせ
このWebサイトは2026年9月に閉鎖いたします。
新しい記事は移転先で追加しております。(旧サイトでは記事を追加しておりません)
細 文字列「__FORCETOC__」を「{{#seo: |title={{PAGENAME}} : Exploring Electronics and SUSE Linux | MochiuWiki |keywords=MochiuWiki,Mochiu,Wiki,Mochiu Wiki,Electric Circuit,Electric,pcb,Mathematics,AVR,TI,STMicro,AVR,ATmega,MSP430,STM,Arduino,Xilinx,FPGA,Verilog,HDL,PinePhone,Pine Phone,Raspberry,Raspberry Pi,C,C++,C#,Qt,Qml,MFC,Shell,Bash,Zsh,Fish,SUSE,SLE,Suse Enterprise,Suse Linux,openSUSE,open SUSE,Leap,Linux,uCLnux,Podman,電気回路,電子回路,基板,プリント基板 |description={{PAGENAME}} - 電子回路とSUSE Linuxに関する情報 | This pag… |
|||
| (同じ利用者による、間の1版が非表示) | |||
| 223行目: | 223行目: | ||
void Converter::suspend() | void Converter::suspend() | ||
{ | { | ||
auto trySuspendCommand = [](const QString &command, const QStringList &arguments) { | auto trySuspendCommand = [this](const QString &command, const QStringList &arguments, bool useAuth = false) { | ||
QProcess process; | QProcess process; | ||
process.start(command | if (useAuth) { | ||
process. | bool ok; | ||
return process.exitCode() | QString password = QInputDialog::getText(this, "rootパスワード", | ||
"サスペンドを実行するためのsudoパスワードを入力:", | |||
QLineEdit::Password, QString(), &ok); | |||
if (!ok || password.isEmpty()) { | |||
qWarning() << "サスペンドがキャンセルされました: パスワードが提供されていません"; | |||
return false; | |||
} | |||
process.start("sudo", QStringList() << "-S" << command << arguments); | |||
if (!process.waitForStarted()) { | |||
qCritical() << "sudoプロセスの開始に失敗: " << process.errorString(); | |||
return false; | |||
} | |||
process.write(password.toUtf8() + "\n"); | |||
} | |||
else { | |||
process.start(command, arguments); | |||
} | |||
// 5秒待機 | |||
if (!process.waitForFinished(5000)) { | |||
qWarning() << "サスペンドプロセスが完了しませんでした: " << process.errorString(); | |||
return false; | |||
} | |||
if (process.exitCode() != 0) { | |||
qWarning() << "サスペンドに失敗しました。終了コード: " << process.exitCode(); | |||
qWarning() << "エラー出力: " << process.readAllStandardError(); | |||
return false; | |||
} | |||
return true; | |||
}; | }; | ||
| 384行目: | 418行目: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br><br> | <br><br> | ||
{{#seo: | |||
|title={{PAGENAME}} : Exploring Electronics and SUSE Linux | MochiuWiki | |||
|keywords=MochiuWiki,Mochiu,Wiki,Mochiu Wiki,Electric Circuit,Electric,pcb,Mathematics,AVR,TI,STMicro,AVR,ATmega,MSP430,STM,Arduino,Xilinx,FPGA,Verilog,HDL,PinePhone,Pine Phone,Raspberry,Raspberry Pi,C,C++,C#,Qt,Qml,MFC,Shell,Bash,Zsh,Fish,SUSE,SLE,Suse Enterprise,Suse Linux,openSUSE,open SUSE,Leap,Linux,uCLnux,Podman,電気回路,電子回路,基板,プリント基板 | |||
|description={{PAGENAME}} - 電子回路とSUSE Linuxに関する情報 | This page is {{PAGENAME}} in our wiki about electronic circuits and SUSE Linux | |||
|image=/resources/assets/MochiuLogo_Single_Blue.png | |||
}} | |||
__FORCETOC__ | __FORCETOC__ | ||
[[カテゴリ:Qt]] | [[カテゴリ:Qt]] | ||