OSDN Git Service

内蔵テキストビューアの行間を設定できるようにした
[gefu/Gefu.git] / global.cpp
index 938fb81..048e970 100644 (file)
@@ -1,5 +1,12 @@
 #include "global.h"
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief appendActionShortcut
+/// \param action   アクションオブジェクト
+/// \param ks       キーシーケンス文字列
+///
+/// アクションにショートカットキーを追加します。
+///
 void appendActionShortcut(QAction *action, const QString &ks)
 {
     QList<QKeySequence> shortcuts = action->shortcuts();
@@ -7,6 +14,11 @@ void appendActionShortcut(QAction *action, const QString &ks)
     action->setShortcuts(shortcuts);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief detectCode
+/// \param bytes    バイト列
+/// \return エンコード文字列を返します。
+///
 std::string detectCode(const QByteArray &bytes)
 {
     const quint8 bEscape = 0x1B;
@@ -22,21 +34,13 @@ std::string detectCode(const QByteArray &bytes)
     int len = bytes.size();
     quint8 b1, b2, b3, b4;
 
-//    bool isBinary = false;
     for (int i = 0; i < len; i++) {
         b1 = bytes[i];
         if (b1 <= 0x06 || b1 == 0x7F || b1 == 0xFF) {
             //'binary'
             return "Binary";
-//            isBinary = true;
-//            if (b1 == 0x00 && i < len - 1 && static_cast<byte>(bytes[i + 1]) <= 0x7F) {
-//                return "UTF-16LE";
-//            }
         }
     }
-//    if (isBinary) {
-//        return "UTF-8";
-//    }
 
     bool notJapanese = true;
     for (int i = 0; i < len; i++) {
@@ -146,6 +150,11 @@ std::string detectCode(const QByteArray &bytes)
 
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief fileSizeToString
+/// \param size サイズ
+/// \return サイズの文字列表記を返します。
+///
 QString fileSizeToString(qint64 size)
 {
     if (size >= 1024 * 1024 * 1024) {
@@ -160,12 +169,18 @@ QString fileSizeToString(qint64 size)
     return QString("%1B").arg(size);
 }
 
-
+///////////////////////////////////////////////////////////////////////////////
+/// \brief reconnectAction
+/// \param sender   送信元アクション
+/// \param signal   シグナル
+/// \param reciever 送信先オブジェクト
+/// \param slot     スロット
+///
+/// シグナルにスロットを再接続します。
+///
 void reconnectAction(QAction *sender, const char *signal, QObject *reciever, const char *slot)
 {
     sender->setEnabled(true);
     sender->disconnect();
     QObject::connect(sender, signal, reciever, slot);
 }
-
-