1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 22:37:35 +00:00

Applications: Run clang-format on everything.

This commit is contained in:
Andreas Kling 2019-06-07 11:48:03 +02:00
parent e09c3a1ae8
commit fd604a7c68
24 changed files with 350 additions and 294 deletions

View file

@ -1,9 +1,9 @@
#include <LibGUI/GApplication.h> #include <LibGUI/GApplication.h>
#include <LibGUI/GWindow.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GButton.h>
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
#include <LibGUI/GButton.h>
#include <LibGUI/GDesktop.h> #include <LibGUI/GDesktop.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GWindow.h>
#include <sys/utsname.h> #include <sys/utsname.h>
int main(int argc, char** argv) int main(int argc, char** argv)

View file

@ -1,7 +1,7 @@
#include <LibGUI/GApplication.h>
#include <LibCore/CHttpRequest.h> #include <LibCore/CHttpRequest.h>
#include <LibCore/CHttpResponse.h> #include <LibCore/CHttpResponse.h>
#include <LibCore/CNetworkJob.h> #include <LibCore/CNetworkJob.h>
#include <LibGUI/GApplication.h>
#include <stdio.h> #include <stdio.h>
int main(int argc, char** argv) int main(int argc, char** argv)

View file

@ -1,8 +1,8 @@
#include "DirectoryView.h" #include "DirectoryView.h"
#include <LibGUI/GSortingProxyModel.h>
#include <AK/FileSystemPath.h> #include <AK/FileSystemPath.h>
#include <unistd.h> #include <LibGUI/GSortingProxyModel.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
void DirectoryView::handle_activation(const GModelIndex& index) void DirectoryView::handle_activation(const GModelIndex& index)
{ {

View file

@ -1,25 +1,25 @@
#include <LibGUI/GWindow.h> #include "DirectoryView.h"
#include <LibGUI/GWidget.h> #include <AK/FileSystemPath.h>
#include <LibGUI/GBoxLayout.h> #include <LibCore/CUserInfo.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h> #include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GFileSystemModel.h>
#include <LibGUI/GInputBox.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GMessageBox.h>
#include <LibGUI/GProgressBar.h>
#include <LibGUI/GSplitter.h>
#include <LibGUI/GStatusBar.h> #include <LibGUI/GStatusBar.h>
#include <LibGUI/GTextEditor.h> #include <LibGUI/GTextEditor.h>
#include <LibGUI/GToolBar.h> #include <LibGUI/GToolBar.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GInputBox.h>
#include <LibGUI/GMessageBox.h>
#include <LibGUI/GProgressBar.h>
#include <LibGUI/GTreeView.h> #include <LibGUI/GTreeView.h>
#include <LibGUI/GFileSystemModel.h> #include <LibGUI/GWidget.h>
#include <LibGUI/GSplitter.h> #include <LibGUI/GWindow.h>
#include <LibCore/CUserInfo.h>
#include <AK/FileSystemPath.h>
#include <unistd.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include "DirectoryView.h" #include <unistd.h>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -92,8 +92,8 @@ int main(int argc, char** argv)
if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty()) { if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty()) {
auto new_dir_path = FileSystemPath(String::format("%s/%s", auto new_dir_path = FileSystemPath(String::format("%s/%s",
directory_view->path().characters(), directory_view->path().characters(),
input_box.text_value().characters() input_box.text_value().characters()))
)).string(); .string();
int rc = mkdir(new_dir_path.characters(), 0777); int rc = mkdir(new_dir_path.characters(), 0777);
if (rc < 0) { if (rc < 0) {
GMessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, window); GMessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, window);

View file

@ -1,13 +1,13 @@
#include "FontEditor.h" #include "FontEditor.h"
#include "GlyphMapWidget.h"
#include "GlyphEditorWidget.h" #include "GlyphEditorWidget.h"
#include <LibGUI/GPainter.h> #include "GlyphMapWidget.h"
#include <LibGUI/GButton.h> #include <LibGUI/GButton.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GTextBox.h>
#include <LibGUI/GCheckBox.h> #include <LibGUI/GCheckBox.h>
#include <LibGUI/GSpinBox.h>
#include <LibGUI/GGroupBox.h> #include <LibGUI/GGroupBox.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GPainter.h>
#include <LibGUI/GSpinBox.h>
#include <LibGUI/GTextBox.h>
#include <stdlib.h> #include <stdlib.h>
FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_font, GWidget* parent) FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_font, GWidget* parent)

View file

@ -44,7 +44,8 @@ Rect GlyphMapWidget::get_outer_rect(byte glyph) const
row * (font().glyph_height() + m_vertical_spacing) + 1, row * (font().glyph_height() + m_vertical_spacing) + 1,
font().max_glyph_width() + m_horizontal_spacing, font().max_glyph_width() + m_horizontal_spacing,
font().glyph_height() + m_horizontal_spacing font().glyph_height() + m_horizontal_spacing
}.translated(frame_thickness(), frame_thickness()); }
.translated(frame_thickness(), frame_thickness());
} }
void GlyphMapWidget::update_glyph(byte glyph) void GlyphMapWidget::update_glyph(byte glyph)
@ -71,8 +72,7 @@ void GlyphMapWidget::paint_event(GPaintEvent& event)
outer_rect.x() + m_horizontal_spacing / 2, outer_rect.x() + m_horizontal_spacing / 2,
outer_rect.y() + m_vertical_spacing / 2, outer_rect.y() + m_vertical_spacing / 2,
font().max_glyph_width(), font().max_glyph_width(),
font().glyph_height() font().glyph_height());
);
if (glyph == m_selected_glyph) { if (glyph == m_selected_glyph) {
painter.fill_rect(outer_rect, Color::from_rgb(0x84351a)); painter.fill_rect(outer_rect, Color::from_rgb(0x84351a));
painter.draw_glyph(inner_rect.location(), glyph, Color::White); painter.draw_glyph(inner_rect.location(), glyph, Color::White);

View file

@ -1,16 +1,16 @@
#include "IRCAppWindow.h" #include "IRCAppWindow.h"
#include "IRCWindow.h" #include "IRCWindow.h"
#include "IRCWindowListModel.h" #include "IRCWindowListModel.h"
#include <LibGUI/GApplication.h>
#include <LibGUI/GStackWidget.h>
#include <LibGUI/GTableView.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GToolBar.h>
#include <LibGUI/GAction.h> #include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GInputBox.h>
#include <LibGUI/GMenu.h> #include <LibGUI/GMenu.h>
#include <LibGUI/GMenuBar.h> #include <LibGUI/GMenuBar.h>
#include <LibGUI/GInputBox.h>
#include <LibGUI/GSplitter.h> #include <LibGUI/GSplitter.h>
#include <LibGUI/GStackWidget.h>
#include <LibGUI/GTableView.h>
#include <LibGUI/GToolBar.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -1,6 +1,6 @@
#include "IRCChannel.h" #include "IRCChannel.h"
#include "IRCClient.h"
#include "IRCChannelMemberListModel.h" #include "IRCChannelMemberListModel.h"
#include "IRCClient.h"
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>

View file

@ -25,7 +25,8 @@ int IRCChannelMemberListModel::column_count(const GModelIndex&) const
String IRCChannelMemberListModel::column_name(int column) const String IRCChannelMemberListModel::column_name(int column) const
{ {
switch (column) { switch (column) {
case Column::Name: return "Name"; case Column::Name:
return "Name";
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
@ -33,7 +34,8 @@ String IRCChannelMemberListModel::column_name(int column) const
GModel::ColumnMetadata IRCChannelMemberListModel::column_metadata(int column) const GModel::ColumnMetadata IRCChannelMemberListModel::column_metadata(int column) const
{ {
switch (column) { switch (column) {
case Column::Name: return { 70, TextAlignment::CenterLeft }; case Column::Name:
return { 70, TextAlignment::CenterLeft };
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
@ -42,7 +44,8 @@ GVariant IRCChannelMemberListModel::data(const GModelIndex& index, Role role) co
{ {
if (role == Role::Display) { if (role == Role::Display) {
switch (index.column()) { switch (index.column()) {
case Column::Name: return m_channel.member_at(index.row()); case Column::Name:
return m_channel.member_at(index.row());
} }
} }
return {}; return {};

View file

@ -1,20 +1,21 @@
#include "IRCClient.h" #include "IRCClient.h"
#include "IRCChannel.h" #include "IRCChannel.h"
#include "IRCQuery.h"
#include "IRCLogBuffer.h" #include "IRCLogBuffer.h"
#include "IRCQuery.h"
#include "IRCWindow.h" #include "IRCWindow.h"
#include "IRCWindowListModel.h" #include "IRCWindowListModel.h"
#include <LibCore/CNotifier.h> #include <LibCore/CNotifier.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <unistd.h> #include <netinet/in.h>
#include <stdio.h> #include <stdio.h>
#include <sys/socket.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#define IRC_DEBUG #define IRC_DEBUG
enum IRCNumeric { enum IRCNumeric
{
RPL_WHOISUSER = 311, RPL_WHOISUSER = 311,
RPL_WHOISSERVER = 312, RPL_WHOISSERVER = 312,
RPL_WHOISOPERATOR = 313, RPL_WHOISOPERATOR = 313,
@ -105,14 +106,16 @@ void IRCClient::process_line(ByteBuffer&& line)
Vector<char, 32> prefix; Vector<char, 32> prefix;
Vector<char, 32> command; Vector<char, 32> command;
Vector<char, 256> current_parameter; Vector<char, 256> current_parameter;
enum { enum
{
Start, Start,
InPrefix, InPrefix,
InCommand, InCommand,
InStartOfParameter, InStartOfParameter,
InParameter, InParameter,
InTrailingParameter, InTrailingParameter,
} state = Start; } state
= Start;
for (int i = 0; i < line.size(); ++i) { for (int i = 0; i < line.size(); ++i) {
char ch = line[i]; char ch = line[i];
@ -216,8 +219,7 @@ void IRCClient::handle(const Message& msg)
printf("IRCClient::execute: prefix='%s', command='%s', arguments=%d\n", printf("IRCClient::execute: prefix='%s', command='%s', arguments=%d\n",
msg.prefix.characters(), msg.prefix.characters(),
msg.command.characters(), msg.command.characters(),
msg.arguments.size() msg.arguments.size());
);
int i = 0; int i = 0;
for (auto& arg : msg.arguments) { for (auto& arg : msg.arguments) {
@ -231,16 +233,26 @@ void IRCClient::handle(const Message& msg)
if (is_numeric) { if (is_numeric) {
switch (numeric) { switch (numeric) {
case RPL_WHOISCHANNELS: return handle_rpl_whoischannels(msg); case RPL_WHOISCHANNELS:
case RPL_ENDOFWHOIS: return handle_rpl_endofwhois(msg); return handle_rpl_whoischannels(msg);
case RPL_WHOISOPERATOR: return handle_rpl_whoisoperator(msg); case RPL_ENDOFWHOIS:
case RPL_WHOISSERVER: return handle_rpl_whoisserver(msg); return handle_rpl_endofwhois(msg);
case RPL_WHOISUSER: return handle_rpl_whoisuser(msg); case RPL_WHOISOPERATOR:
case RPL_WHOISIDLE: return handle_rpl_whoisidle(msg); return handle_rpl_whoisoperator(msg);
case RPL_TOPICWHOTIME: return handle_rpl_topicwhotime(msg); case RPL_WHOISSERVER:
case RPL_TOPIC: return handle_rpl_topic(msg); return handle_rpl_whoisserver(msg);
case RPL_NAMREPLY: return handle_rpl_namreply(msg); case RPL_WHOISUSER:
case RPL_ENDOFNAMES: return handle_rpl_endofnames(msg); return handle_rpl_whoisuser(msg);
case RPL_WHOISIDLE:
return handle_rpl_whoisidle(msg);
case RPL_TOPICWHOTIME:
return handle_rpl_topicwhotime(msg);
case RPL_TOPIC:
return handle_rpl_topic(msg);
case RPL_NAMREPLY:
return handle_rpl_namreply(msg);
case RPL_ENDOFNAMES:
return handle_rpl_endofnames(msg);
} }
} }
@ -502,8 +514,7 @@ void IRCClient::handle_rpl_whoisuser(const Message& msg)
nick.characters(), nick.characters(),
username.characters(), username.characters(),
host.characters(), host.characters(),
realname.characters() realname.characters()));
));
} }
void IRCClient::handle_rpl_whoisidle(const Message& msg) void IRCClient::handle_rpl_whoisidle(const Message& msg)
@ -541,8 +552,7 @@ void IRCClient::handle_rpl_topicwhotime(const Message& msg)
tm->tm_mday, tm->tm_mday,
tm->tm_hour, tm->tm_hour,
tm->tm_min, tm->tm_min,
tm->tm_sec tm->tm_sec);
);
} }
ensure_channel(channel_name).add_message(String::format("*** (set by %s at %s)", nick.characters(), setat.characters()), Color::Blue); ensure_channel(channel_name).add_message(String::format("*** (set by %s at %s)", nick.characters(), setat.characters()), Color::Blue);
} }

View file

@ -1,8 +1,8 @@
#include "IRCLogBufferModel.h" #include "IRCLogBufferModel.h"
#include "IRCLogBuffer.h" #include "IRCLogBuffer.h"
#include <SharedGraphics/Font.h>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <SharedGraphics/Font.h>
IRCLogBufferModel::IRCLogBufferModel(Retained<IRCLogBuffer>&& log_buffer) IRCLogBufferModel::IRCLogBufferModel(Retained<IRCLogBuffer>&& log_buffer)
: m_log_buffer(move(log_buffer)) : m_log_buffer(move(log_buffer))
@ -26,9 +26,12 @@ int IRCLogBufferModel::column_count(const GModelIndex&) const
String IRCLogBufferModel::column_name(int column) const String IRCLogBufferModel::column_name(int column) const
{ {
switch (column) { switch (column) {
case Column::Timestamp: return "Time"; case Column::Timestamp:
case Column::Name: return "Name"; return "Time";
case Column::Text: return "Text"; case Column::Name:
return "Name";
case Column::Text:
return "Text";
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
@ -36,9 +39,12 @@ String IRCLogBufferModel::column_name(int column) const
GModel::ColumnMetadata IRCLogBufferModel::column_metadata(int column) const GModel::ColumnMetadata IRCLogBufferModel::column_metadata(int column) const
{ {
switch (column) { switch (column) {
case Column::Timestamp: return { 60, TextAlignment::CenterLeft }; case Column::Timestamp:
case Column::Name: return { 70, TextAlignment::CenterRight, &Font::default_bold_font() }; return { 60, TextAlignment::CenterLeft };
case Column::Text: return { 800, TextAlignment::CenterLeft }; case Column::Name:
return { 70, TextAlignment::CenterRight, &Font::default_bold_font() };
case Column::Text:
return { 800, TextAlignment::CenterLeft };
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
@ -56,7 +62,8 @@ GVariant IRCLogBufferModel::data(const GModelIndex& index, Role role) const
if (entry.sender.is_empty()) if (entry.sender.is_empty())
return String::empty(); return String::empty();
return String::format("<%c%s>", entry.prefix ? entry.prefix : ' ', entry.sender.characters()); return String::format("<%c%s>", entry.prefix ? entry.prefix : ' ', entry.sender.characters());
case Column::Text: return entry.text; case Column::Text:
return entry.text;
} }
} }
if (role == Role::ForegroundColor) { if (role == Role::ForegroundColor) {

View file

@ -1,13 +1,13 @@
#include "IRCWindow.h" #include "IRCWindow.h"
#include "IRCClient.h"
#include "IRCChannel.h" #include "IRCChannel.h"
#include "IRCChannelMemberListModel.h" #include "IRCChannelMemberListModel.h"
#include "IRCClient.h"
#include "IRCLogBufferModel.h" #include "IRCLogBufferModel.h"
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
#include <LibGUI/GTableView.h>
#include <LibGUI/GTextEditor.h>
#include <LibGUI/GTextBox.h>
#include <LibGUI/GSplitter.h> #include <LibGUI/GSplitter.h>
#include <LibGUI/GTableView.h>
#include <LibGUI/GTextBox.h>
#include <LibGUI/GTextEditor.h>
IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name, GWidget* parent) IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name, GWidget* parent)
: GWidget(parent) : GWidget(parent)

View file

@ -1,7 +1,7 @@
#include "IRCWindowListModel.h" #include "IRCWindowListModel.h"
#include "IRCWindow.h"
#include "IRCClient.h"
#include "IRCChannel.h" #include "IRCChannel.h"
#include "IRCClient.h"
#include "IRCWindow.h"
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
@ -27,7 +27,8 @@ int IRCWindowListModel::column_count(const GModelIndex&) const
String IRCWindowListModel::column_name(int column) const String IRCWindowListModel::column_name(int column) const
{ {
switch (column) { switch (column) {
case Column::Name: return "Name"; case Column::Name:
return "Name";
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
@ -35,7 +36,8 @@ String IRCWindowListModel::column_name(int column) const
GModel::ColumnMetadata IRCWindowListModel::column_metadata(int column) const GModel::ColumnMetadata IRCWindowListModel::column_metadata(int column) const
{ {
switch (column) { switch (column) {
case Column::Name: return { 70, TextAlignment::CenterLeft }; case Column::Name:
return { 70, TextAlignment::CenterLeft };
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }

View file

@ -1,6 +1,6 @@
#include "IRCAppWindow.h"
#include "IRCClient.h" #include "IRCClient.h"
#include <LibGUI/GApplication.h> #include <LibGUI/GApplication.h>
#include "IRCAppWindow.h"
#include <stdio.h> #include <stdio.h>
int main(int argc, char** argv) int main(int argc, char** argv)

View file

@ -1,16 +1,16 @@
#include <SharedGraphics/GraphicsBitmap.h> #include <LibCore/CConfigFile.h>
#include <LibGUI/GWindow.h> #include <LibCore/CUserInfo.h>
#include <LibGUI/GWidget.h>
#include <LibGUI/GButton.h>
#include <LibGUI/GApplication.h> #include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
#include <LibCore/CConfigFile.h> #include <LibGUI/GButton.h>
#include <sys/wait.h> #include <LibGUI/GWidget.h>
#include <signal.h> #include <LibGUI/GWindow.h>
#include <unistd.h> #include <SharedGraphics/GraphicsBitmap.h>
#include <stdio.h>
#include <errno.h> #include <errno.h>
#include <LibCore/CUserInfo.h> #include <signal.h>
#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
static GWindow* make_launcher_window(); static GWindow* make_launcher_window();
@ -55,7 +55,8 @@ public:
perror("execl"); perror("execl");
} }
}; };
} virtual ~LauncherButton() { } }
virtual ~LauncherButton() {}
private: private:
String m_executable_path; String m_executable_path;

View file

@ -1,8 +1,8 @@
#include "MemoryStatsWidget.h" #include "MemoryStatsWidget.h"
#include "GraphWidget.h" #include "GraphWidget.h"
#include <LibGUI/GPainter.h>
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
#include <LibGUI/GLabel.h> #include <LibGUI/GLabel.h>
#include <LibGUI/GPainter.h>
#include <SharedGraphics/StylePainter.h> #include <SharedGraphics/StylePainter.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -2,8 +2,8 @@
#include "GraphWidget.h" #include "GraphWidget.h"
#include <LibCore/CFile.h> #include <LibCore/CFile.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h>
#include <pwd.h> #include <pwd.h>
#include <stdio.h>
ProcessModel::ProcessModel(GraphWidget& graph) ProcessModel::ProcessModel(GraphWidget& graph)
: m_graph(graph) : m_graph(graph)
@ -42,34 +42,56 @@ int ProcessModel::column_count(const GModelIndex&) const
String ProcessModel::column_name(int column) const String ProcessModel::column_name(int column) const
{ {
switch (column) { switch (column) {
case Column::Icon: return ""; case Column::Icon:
case Column::PID: return "PID"; return "";
case Column::State: return "State"; case Column::PID:
case Column::User: return "User"; return "PID";
case Column::Priority: return "Pr"; case Column::State:
case Column::Linear: return "Linear"; return "State";
case Column::Physical: return "Physical"; case Column::User:
case Column::CPU: return "CPU"; return "User";
case Column::Name: return "Name"; case Column::Priority:
case Column::Syscalls: return "Syscalls"; return "Pr";
default: ASSERT_NOT_REACHED(); case Column::Linear:
return "Linear";
case Column::Physical:
return "Physical";
case Column::CPU:
return "CPU";
case Column::Name:
return "Name";
case Column::Syscalls:
return "Syscalls";
default:
ASSERT_NOT_REACHED();
} }
} }
GModel::ColumnMetadata ProcessModel::column_metadata(int column) const GModel::ColumnMetadata ProcessModel::column_metadata(int column) const
{ {
switch (column) { switch (column) {
case Column::Icon: return { 16, TextAlignment::CenterLeft }; case Column::Icon:
case Column::PID: return { 32, TextAlignment::CenterRight }; return { 16, TextAlignment::CenterLeft };
case Column::State: return { 75, TextAlignment::CenterLeft }; case Column::PID:
case Column::Priority: return { 16, TextAlignment::CenterLeft }; return { 32, TextAlignment::CenterRight };
case Column::User: return { 50, TextAlignment::CenterLeft }; case Column::State:
case Column::Linear: return { 65, TextAlignment::CenterRight }; return { 75, TextAlignment::CenterLeft };
case Column::Physical: return { 65, TextAlignment::CenterRight }; case Column::Priority:
case Column::CPU: return { 32, TextAlignment::CenterRight }; return { 16, TextAlignment::CenterLeft };
case Column::Name: return { 140, TextAlignment::CenterLeft }; case Column::User:
case Column::Syscalls: return { 60, TextAlignment::CenterRight }; return { 50, TextAlignment::CenterLeft };
default: ASSERT_NOT_REACHED(); case Column::Linear:
return { 65, TextAlignment::CenterRight };
case Column::Physical:
return { 65, TextAlignment::CenterRight };
case Column::CPU:
return { 32, TextAlignment::CenterRight };
case Column::Name:
return { 140, TextAlignment::CenterLeft };
case Column::Syscalls:
return { 60, TextAlignment::CenterRight };
default:
ASSERT_NOT_REACHED();
} }
} }
@ -87,10 +109,14 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
if (role == Role::Sort) { if (role == Role::Sort) {
switch (index.column()) { switch (index.column()) {
case Column::Icon: return 0; case Column::Icon:
case Column::PID: return process.current_state.pid; return 0;
case Column::State: return process.current_state.state; case Column::PID:
case Column::User: return process.current_state.user; return process.current_state.pid;
case Column::State:
return process.current_state.state;
case Column::User:
return process.current_state.user;
case Column::Priority: case Column::Priority:
if (process.current_state.priority == "Idle") if (process.current_state.priority == "Idle")
return 0; return 0;
@ -102,12 +128,17 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
return 3; return 3;
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
return 3; return 3;
case Column::Linear: return (int)process.current_state.linear; case Column::Linear:
case Column::Physical: return (int)process.current_state.physical; return (int)process.current_state.linear;
case Column::CPU: return process.current_state.cpu_percent; case Column::Physical:
case Column::Name: return process.current_state.name; return (int)process.current_state.physical;
case Column::CPU:
return process.current_state.cpu_percent;
case Column::Name:
return process.current_state.name;
// FIXME: GVariant with unsigned? // FIXME: GVariant with unsigned?
case Column::Syscalls: return (int)process.current_state.syscalls; case Column::Syscalls:
return (int)process.current_state.syscalls;
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
return {}; return {};
@ -115,10 +146,14 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
if (role == Role::Display) { if (role == Role::Display) {
switch (index.column()) { switch (index.column()) {
case Column::Icon: return *m_generic_process_icon; case Column::Icon:
case Column::PID: return process.current_state.pid; return *m_generic_process_icon;
case Column::State: return process.current_state.state; case Column::PID:
case Column::User: return process.current_state.user; return process.current_state.pid;
case Column::State:
return process.current_state.state;
case Column::User:
return process.current_state.user;
case Column::Priority: case Column::Priority:
if (process.current_state.priority == "Idle") if (process.current_state.priority == "Idle")
return String::empty(); return String::empty();
@ -129,12 +164,17 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
if (process.current_state.priority == "Normal") if (process.current_state.priority == "Normal")
return *m_normal_priority_icon; return *m_normal_priority_icon;
return process.current_state.priority; return process.current_state.priority;
case Column::Linear: return pretty_byte_size(process.current_state.linear); case Column::Linear:
case Column::Physical: return pretty_byte_size(process.current_state.physical); return pretty_byte_size(process.current_state.linear);
case Column::CPU: return process.current_state.cpu_percent; case Column::Physical:
case Column::Name: return process.current_state.name; return pretty_byte_size(process.current_state.physical);
case Column::CPU:
return process.current_state.cpu_percent;
case Column::Name:
return process.current_state.name;
// FIXME: It's weird that GVariant doesn't support unsigned ints. Should it? // FIXME: It's weird that GVariant doesn't support unsigned ints. Should it?
case Column::Syscalls: return (int)process.current_state.syscalls; case Column::Syscalls:
return (int)process.current_state.syscalls;
} }
} }

View file

@ -1,20 +1,20 @@
#include <LibCore/CTimer.h>
#include <LibGUI/GWindow.h>
#include <LibGUI/GWidget.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GToolBar.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GGroupBox.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GTabWidget.h>
#include <LibGUI/GLabel.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include "ProcessTableView.h"
#include "MemoryStatsWidget.h"
#include "GraphWidget.h" #include "GraphWidget.h"
#include "MemoryStatsWidget.h"
#include "ProcessTableView.h"
#include <LibCore/CTimer.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GGroupBox.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GTabWidget.h>
#include <LibGUI/GToolBar.h>
#include <LibGUI/GWidget.h>
#include <LibGUI/GWindow.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {

View file

@ -1,8 +1,8 @@
#include "TaskbarButton.h" #include "TaskbarButton.h"
#include <WindowServer/WSAPITypes.h>
#include <LibGUI/GAction.h> #include <LibGUI/GAction.h>
#include <LibGUI/GMenu.h>
#include <LibGUI/GEventLoop.h> #include <LibGUI/GEventLoop.h>
#include <LibGUI/GMenu.h>
#include <WindowServer/WSAPITypes.h>
static void set_window_minimized_state(const WindowIdentifier& identifier, bool minimized) static void set_window_minimized_state(const WindowIdentifier& identifier, bool minimized)
{ {

View file

@ -1,11 +1,11 @@
#include "TaskbarWindow.h" #include "TaskbarWindow.h"
#include "TaskbarButton.h" #include "TaskbarButton.h"
#include <LibGUI/GWindow.h>
#include <LibGUI/GDesktop.h>
#include <LibGUI/GEventLoop.h>
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
#include <LibGUI/GButton.h> #include <LibGUI/GButton.h>
#include <LibGUI/GDesktop.h>
#include <LibGUI/GEventLoop.h>
#include <LibGUI/GFrame.h> #include <LibGUI/GFrame.h>
#include <LibGUI/GWindow.h>
#include <WindowServer/WSAPITypes.h> #include <WindowServer/WSAPITypes.h>
#include <stdio.h> #include <stdio.h>
@ -70,8 +70,7 @@ void TaskbarWindow::wm_event(GWMEvent& event)
auto& removed_event = static_cast<GWMWindowRemovedEvent&>(event); auto& removed_event = static_cast<GWMWindowRemovedEvent&>(event);
dbgprintf("WM_WindowRemoved: client_id=%d, window_id=%d\n", dbgprintf("WM_WindowRemoved: client_id=%d, window_id=%d\n",
removed_event.client_id(), removed_event.client_id(),
removed_event.window_id() removed_event.window_id());
);
#endif #endif
WindowList::the().remove_window(identifier); WindowList::the().remove_window(identifier);
update(); update();
@ -83,8 +82,7 @@ void TaskbarWindow::wm_event(GWMEvent& event)
dbgprintf("WM_WindowRectChanged: client_id=%d, window_id=%d, rect=%s\n", dbgprintf("WM_WindowRectChanged: client_id=%d, window_id=%d, rect=%s\n",
changed_event.client_id(), changed_event.client_id(),
changed_event.window_id(), changed_event.window_id(),
changed_event.rect().to_string().characters() changed_event.rect().to_string().characters());
);
#endif #endif
break; break;
} }
@ -94,8 +92,7 @@ void TaskbarWindow::wm_event(GWMEvent& event)
dbgprintf("WM_WindowIconChanged: client_id=%d, window_id=%d, icon_path=%s\n", dbgprintf("WM_WindowIconChanged: client_id=%d, window_id=%d, icon_path=%s\n",
changed_event.client_id(), changed_event.client_id(),
changed_event.window_id(), changed_event.window_id(),
changed_event.icon_path().characters() changed_event.icon_path().characters());
);
#endif #endif
if (auto* window = WindowList::the().window(identifier)) { if (auto* window = WindowList::the().window(identifier)) {
window->set_icon_path(changed_event.icon_path()); window->set_icon_path(changed_event.icon_path());
@ -113,8 +110,7 @@ void TaskbarWindow::wm_event(GWMEvent& event)
changed_event.title().characters(), changed_event.title().characters(),
changed_event.rect().to_string().characters(), changed_event.rect().to_string().characters(),
changed_event.is_active(), changed_event.is_active(),
changed_event.is_minimized() changed_event.is_minimized());
);
#endif #endif
if (!should_include_window(changed_event.window_type())) if (!should_include_window(changed_event.window_type()))
break; break;

View file

@ -1,6 +1,6 @@
#include "WindowList.h" #include "WindowList.h"
#include <WindowServer/WSAPITypes.h>
#include <LibGUI/GEventLoop.h> #include <LibGUI/GEventLoop.h>
#include <WindowServer/WSAPITypes.h>
WindowList& WindowList::the() WindowList& WindowList::the()
{ {

View file

@ -1,5 +1,5 @@
#include <LibGUI/GApplication.h>
#include "TaskbarWindow.h" #include "TaskbarWindow.h"
#include <LibGUI/GApplication.h>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {

View file

@ -1,27 +1,26 @@
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <assert.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <pwd.h>
#include "Terminal.h" #include "Terminal.h"
#include <Kernel/KeyCode.h> #include <Kernel/KeyCode.h>
#include <LibCore/CUserInfo.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h> #include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
#include <LibGUI/GRadioButton.h> #include <LibGUI/GFontDatabase.h>
#include <LibGUI/GWidget.h>
#include <LibGUI/GWindow.h>
#include <LibGUI/GGroupBox.h> #include <LibGUI/GGroupBox.h>
#include <LibGUI/GMenuBar.h> #include <LibGUI/GMenuBar.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GFontDatabase.h>
#include <LibGUI/GSlider.h>
#include <LibGUI/GRadioButton.h> #include <LibGUI/GRadioButton.h>
#include <LibCore/CUserInfo.h> #include <LibGUI/GSlider.h>
#include <LibGUI/GWidget.h>
#include <LibGUI/GWindow.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <unistd.h>
static void make_shell(int ptm_fd) static void make_shell(int ptm_fd)
{ {
@ -88,7 +87,6 @@ GWindow* create_settings_window(Terminal& terminal, RetainPtr<CConfigFile> confi
window->set_title("Terminal Settings"); window->set_title("Terminal Settings");
window->set_rect(50, 50, 200, 140); window->set_rect(50, 50, 200, 140);
auto* settings = new GWidget; auto* settings = new GWidget;
window->set_main_widget(settings); window->set_main_widget(settings);
settings->set_fill_with_background_color(true); settings->set_fill_with_background_color(true);
@ -172,8 +170,7 @@ int main(int argc, char** argv)
app_menu->add_action(GAction::create("Settings...", app_menu->add_action(GAction::create("Settings...",
[&settings_window, &terminal, &config](const GAction&) { [&settings_window, &terminal, &config](const GAction&) {
if (!settings_window) if (!settings_window)
settings_window = settings_window = create_settings_window(terminal, config)->make_weak_ptr();
create_settings_window(terminal, config)->make_weak_ptr();
settings_window->show(); settings_window->show();
settings_window->move_to_front(); settings_window->move_to_front();
})); }));

View file

@ -1,21 +1,21 @@
#include <LibGUI/GWindow.h> #include <AK/StringBuilder.h>
#include <LibGUI/GWidget.h> #include <LibCore/CFile.h>
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h> #include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GFilePicker.h> #include <LibGUI/GFilePicker.h>
#include <LibGUI/GFontDatabase.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GMessageBox.h> #include <LibGUI/GMessageBox.h>
#include <LibGUI/GStatusBar.h> #include <LibGUI/GStatusBar.h>
#include <LibGUI/GToolBar.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GTextEditor.h> #include <LibGUI/GTextEditor.h>
#include <LibGUI/GAction.h> #include <LibGUI/GToolBar.h>
#include <LibGUI/GFontDatabase.h> #include <LibGUI/GWidget.h>
#include <LibCore/CFile.h> #include <LibGUI/GWindow.h>
#include <AK/StringBuilder.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
void open_sesame(GWindow& window, GTextEditor& editor, const String& path) void open_sesame(GWindow& window, GTextEditor& editor, const String& path)
{ {