Download Server Monitor(cqt-linux)/src/main.cpp from mchuca/ServerMonitor: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/mchuca/ServerMonitor/resolve/main/Server%20Monitor(cqt-linux)/src/main.cpp
- Command line
-
hf download 'hf://mchuca/ServerMonitor/Server Monitor(cqt-linux)/src/main.cpp'
-
curl -L -o main.cpp 'https://huggingface.co/mchuca/ServerMonitor/resolve/main/Server%20Monitor(cqt-linux)/src/main.cpp'
1.92 kB
| // Server Monitor - entry point. | |
| int main(int argc, char *argv[]) | |
| { | |
| // ssh runs this executable as SSH_ASKPASS when a password is configured | |
| if (const QByteArray pw = qEnvironmentVariable("SERVERMONITOR_ASKPASS").toUtf8(); !pw.isEmpty()) return std::puts(pw.constData()) < 0; | |
| QApplication::setAttribute(Qt::AA_EnableHighDpiScaling), QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); | |
| QApplication app(argc, argv); | |
| QApplication::setApplicationName("ServerMonitor"), QApplication::setOrganizationName("ServerMonitor"), QApplication::setQuitOnLastWindowClosed(false); | |
| app.setStyle(QStyleFactory::create("Fusion")); | |
| QPalette pal; | |
| for (auto [role, color] : {std::pair{QPalette::Window, C::bg}, {QPalette::WindowText, C::text}, {QPalette::Base, QColor(0x111727)}, {QPalette::AlternateBase, C::panel}, | |
| {QPalette::Text, C::text}, {QPalette::Button, C::card}, {QPalette::ButtonText, C::text}, {QPalette::Highlight, QColor(0x17304a)}, | |
| {QPalette::HighlightedText, C::text}, {QPalette::ToolTipBase, C::card}, {QPalette::ToolTipText, C::text}, {QPalette::PlaceholderText, C::faint}}) | |
| pal.setColor(role, color); | |
| pal.setColor(QPalette::Disabled, QPalette::Text, C::faint), pal.setColor(QPalette::Disabled, QPalette::ButtonText, C::faint); | |
| app.setPalette(pal), app.setWindowIcon(C::appIcon()), app.setStyleSheet(C::styleSheet()); | |
| ServerManager mgr; | |
| MainWindow w(&mgr); | |
| mgr.load(); | |
| w.show(); | |
| if (const QString dir = qEnvironmentVariable("SERVERMONITOR_SNAPSHOT"); !dir.isEmpty()) // developer aid | |
| QTimer::singleShot(qMax(1, qEnvironmentVariableIntValue("SERVERMONITOR_SNAPSHOT_DELAY")) * 1000, &w, [&w, dir] { w.saveSnapshots(dir), qApp->quit(); }); | |
| return app.exec(); | |
| } | |